Welcome to the OpenCities help centre. Search for what you're after, or browse the categories.
Can't find what you're looking for? Submit a support ticket and we'll be in touch.

Follow

Importing content

avatar of OpenCities Product Team

OpenCities Product Team

Last updated

This task can be undertaken by users with the following roles: OC Site Manager and OC System Administrator.

The import content feature is used to bulk import content into your OpenCities site using a spreadsheet containing the data for each page. This can be content you've exported from our system for bulk-editing or content from another CMS you've used previously.

You need to import content according to OpenCities content types, so you may need to import one branch of your site tree at a time. Additionally, your spreadsheet needs to be formatted correctly for the import to occur.

There's a lot to cover for importing content, so use this table of contents to jump to what you need:

Create a spreadsheet for importing

When importing content, you first need to create a spreadsheet with the data for each page you're importing. This file will need to be in one of these formats: .xls, .xlsx, .zip, .rar, or .7z.

Each column of your spreadsheet needs to represent a field of data, and each row will represent a content page. The first row will be a header row with field names corresponding to the content type you're importing. When you import the file, you'll need to map each column to the corresponding field, so they need to be recognizable.

The easiest way to get a spreadsheet for a specific content type is to export content you already have on your site and use that file to build up the rest of your content data. This way, you could download an export file for each content type and know exactly what fields you need to fill in before importing it.

You'll also find sample spreadsheets below for importing these common content types: OC Park, OC Venue, and OC Event. Each spreadsheet will have some sample data in the second row; delete this information before filling out the data you need to import. But if you need to create your own spreadsheet, here are some notes on the essential fields to include.

Content identifiers and Page names

Each page on your site will need a unique content identifier and Page name. In your spreadsheet, you must include a unique Page name for each content page being imported, but if you don't have a content identifier, the system will assign one to each page upon import.

If there are pages with the same name imported into the same branch of the site, only the first page will be imported. The rest will be skipped to avoid duplicate URLs.

Page fields

Simple page fields, such as text boxes, text areas, WYSIWYG Editors, dropdown lists, radio buttons, and checkboxes, will require a single column in the spreadsheet. Here are some things to keep in mind:

  • WYSIWYG content needs to be in HTML.
  • You can add multiple values in the checkbox and list cells by separating each value by a comma and a new line (press alt+enter in Excel to start a new line). Additionally, if those values don't exist for that field in OpenCities, they'll be added to the field's options.
  • Content labels can include alphabetical and numeric characters and hyphens. A space or comma must separate each label. Any special characters will be removed.

Hyperlink fields

Hyperlink fields require three cells, such as related links or website fields. If one of those cells has no value, the link may not be imported correctly. These cells can hold multiple values; you need to separate each value by a comma and a new link (alt+enter for a new line in Excel). These are the cells you'll need:

Header row Hyperlink text Hyperlink URL Hyperlink target
Page row Sample link https://www.domain.com/Sample-link currentwindow
Page row

Sample link 1,

Sample link 2

https://www.domain.com/Sample-link-1

https://www.domain.com/Sample-link-2 

currentwindow,

newwindow

File upload fields

There are four different types of upload fields, each with up to four cells in the spreadsheet. You will also need to include each file in a folder when you upload – you can upload your content files folder and your spreadsheet together by compressing them into a .zip file. Your spreadsheet will need to include the file name and file path for each file, as well as text, descriptions, transcripts, or alt text, depending on the file type.

To upload multiple files for the same page, you can enter multiple values in each cell and separate each one with a comma and a new line. The order of values in each cell for each file must be the same, as they will correspond to each other.

This should be the folder structure of your .zip file:

/ (zip folder)
 - import.xls
 - video-transcript.txt
 - content-files (folder)
   - flowers.png
   - agenda-20160101.pdf
   - flash.swf
   - video.mp4

And these are the values you'll need in your spreadsheet, divided into each file type:

Image upload
Main Image - File Name Main Image - File Alt Text Main Image - File Path  
flowers.png a bunch of red flowers content-files/flower.png  
Document upload
Agenda - File Name Agenda - File Description Agenda - File Link Text Agenda - File Path
Agenda-20160101.pdf 2016 Council Meeting Agenda Download 2016 Agenda content-files/agenda-20160101.pdf
Media upload
Media Upload - File Name Media Upload - File Description Media Upload - File Path Media Upload - File Transcript Path
video.mp4 council meeting 2016 January video recording content-files/video.mp4 video-transcript.txt

Date fields

It's quite straightforward to enter date information for single, timespan, and multiple date formats, but the recurring pattern is a bit more tricky. You'll need to specify the date pattern type and add the date(s) or date pattern.

Use the examples provided in the Date fields.xlsx attachment in the Resources section to ensure you're using the right format.

Notes for recurring date scenarios:

  • Don't start the string of characters with a space.
  • The time zone value is optional, but you should add your time zone. If it's not specified, the server time zone will be used.
  • The string of characters should look like this: "Time Zone: [insert time zone]. Start Time: [insert start time]. Recurrence Pattern - [insert pattern]. End Time: [insert end time]"

Once you've created the spreadsheet, make sure you:

  1. Copy any content files into the same folder as your spreadsheet (they can be at the same level or in subfolders), and
  2. Compress the folder into a .zip file.

You're now ready to import. 

Import your content

To import content, you'll need to start in the Pages section of your admin, as you'll need access to the site tree.

  1. Right-click on the parent page of the section of your site tree that you want to import to, and select Import Content.
  2. Choose the content type you want to import, then select Next.
  3. Select Upload a file, then locate your spreadsheet and upload it. Your file must be in one of these formats: .xls, .xlsx, .zip, .rar, or .7z.
    import content by content type
  4. Select your Import options. We do not recommend checking the Publish after uploading box, as you should double-check your content has been imported correctly before going live. 
  5. Under For duplicate names... select how you want to handle pages with the same Name. Please note that, regardless of which option you choose here, pages with duplicate names will not import into one section of the site. Only the first page will be imported to avoid duplicate URLs.
  6. Select the Content owner and author, then choose which Content template you want. Content types with only one template will be set to the default.
    import content options
  7. Map the columns in your spreadsheet to the fields available for the template, then select Next.
  8. You'll see a summary of the pages that will be imported, along with their status:
    • New page: the page will import as a new page.
    • Renamed: the page will be imported and renamed, as there is an existing page in that branch of the site with the same name.
    • Skipped: the page will not be imported.
      import content summary
  9. If everything looks okay with the summary, select Import.

Your content will be imported into that branch of the site tree. We recommend reviewing each page before publishing to ensure that the page isn't missing anything and that it's been formatted correctly.

Troubleshooting tips

Here are some things you can do to try and avoid errors when importing your content:

  • Try and ensure there are no duplicates in your spreadsheet or the section of your site.
  • Check your WYSIWYG content to ensure there are no extraneous HTML tags.
  • Check your content files folder to ensure that all the files you want to upload are there.
  • If you're getting repeated errors, it may be because you're trying to import too much content at once. Try and start with importing 100 pages at a time, and reduce that number if you continue to get errors.

What else?

Resources

Was this article helpful?
0 out of 0 found this helpful