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 is for users with the OC Site Manager or OC System Administrator roles.

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

You must 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 must be formatted correctly for the import.

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. This file must be in one of the following formats: XLS, XLSX, ZIP, RAR, or 7Z.

Each column of your spreadsheet needs to represent a data field, 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 must 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 what fields you must 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 pages with the same name are 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, drop-down 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, such as related links or website fields, require three cells. If one of those cells has no value, the link may not be imported correctly. These cells can hold multiple values; you must 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 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 must include the file name and 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

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

Entering date information for single, timespan, and multiple date formats is straightforward, 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.

To ensure you use the right format, use the examples provided in the Date fields.xlsx attachment in the Resources section.

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.
    1. 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
  3. 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. 
  4. 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 be imported into one site section. Only the first page will be imported to avoid duplicate URLs.
  5. 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
  6. Map the columns in your spreadsheet to the fields available for the template, then select Next.
  7. You'll see a summary of the pages that will be imported, along with their status:
    • New page: the page will be imported as a new page.
    • Renamed: the page will be imported and renamed, as there is an existing page in that site branch with the same name.
    • Skipped: the page will not be imported.
      import content summary
  8. 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 it isn't missing anything and that it's formatted correctly.

Troubleshooting Tips

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

  • Try to 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 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 simultaneously. Try 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