This is a Developer task |
A content type is a collection of fields. Each OpenCities page is of a certain content type. For more on how content types are used in OpenCities, please see our overview of the OpenCities framework.
OpenCities contains a set of core content types. These content types relate to the modules you have installed. If the existing content types don’t cover your needs, you can create your own.
- Go to More > Content Types
- Click Create New Content Type, or choose an existing content type to edit it.
- In the Overview tab, set up your content type. Keep reading to find out what each option does.
Edit an OpenCities content type
If you edit an OpenCities content type, you’ll only be able to change a few options. These include Auto review days, Auto deactivate days, Auto deactivate previous versions, Hide from navigation, Hide from search and Retain scheduling.
Content type options
Name
Enter a unique name for your field. It can’t contain any URL-unfriendly characters such as “?&, etc. We recommend keeping the name simple and generic so you can reuse the field later.
Description
A small description of the content type to help other admin users understand what it’s for.
Auto review days
If the author leaves the review date empty when they publish a page or file, the system will use this field to set a review date. This review date will be the publish date plus the number of days set here. Set this to 0 to disable this feature.
Auto deactivate days
If the author leaves the deactivate date empty when they publish a page or file, the system will use this field to set a deactivate date. This deactivate date will be the publish date plus the number of days set here. Set this to 0 to disable this feature.
Auto deactivate previous versions
Check this box to deactivate the previous version when a content author publishes a page or file of this content type. The author will be able to overwrite this setting when they publish the page or file, depending on their permission level.
Hide from navigation
Check this box to automatically hide pages of this content type from the site menu. Content authors can overwrite this in the content admin Settings tab.
Hide from search
Check this box to automatically hide pages of this content type from the site search. Content authors can overwrite this in the content admin Settings tab.
Retain scheduling
Check this box to automatically retain the scheduling dates when a new version of a page of this content type is created. If this isn’t enabled, the scheduling will be cleared.
Endpoint for API
This is auto-generated based on the content type Name. This endpoint should be used with the Content API.
Icon
An icon to represent the content type. This will be used in a few places in OpenCities.
Use in site
Select which sites to use the content type in.
Maximum file size
Available only for Document, Image, Flash and Media content types. This allows you to set an application wide maximum file size for the particular content type.
File type extensions
Available only for Document, Image, Flash and Media content types. A comma separated list of file extensions that is included for the particular content type. E.g : pdf, doc, xls, csv
Once you’ve finished with the Overview tab, switch to the Fields tab and select the fields you want to include in the content type.
Add or remove fields from a content type
A content type can have any number of fields depending on your needs. To add or remove fields from a content type:
- Go to More > Content Types.
- Select the content type you want to edit and switch to the Fields tab.
- In the Fields tab, use the search text box to filter the existing fields.
- Select a field to add it to the content type.
- Drag and drop to reorder the fields.
- Hover over a row and click the cog button > Delete to remove a field.
- Save when you’re done.
You can use section headers to group your fields. Fields under a section header will be displayed as an accordion panel in the content admin screen.
Field settings
Description
Use this option to overwrite the field description for this particular content type. The entered description will be displayed to authors in the content admin screens instead of the field description.
Is Required
Check this box to prevent authors from publishing a page or file without entering a value.
Hide Input
Check this box to hide the input from the content author. It can be used if you want to have a field with a default value that is hidden from the author.
Hide Input on a section header means that the section will be collapsed when the content admin is loaded. If it’s unchecked, the section will be expanded by default.
What's next?
Now you've made a content type, you should make sure you're happy with its template.
After that, go ahead and create a page with your new content type.