Custom data attributes act like text attributes for your page or site. You can use them for any number of uses including structuring text content on a faculty profile, adding a class to a
<div> that is easily editable by a content author, or for entering a site-wide calendar category. These are just a few examples among many of what you could do with Custom Data for your page or site.
We’ll first look at how custom data interacts with pages:
- Add a
custom_data_attributesentry to the theme
custom_data_attributes: - key_1 - key_2 - example_3 - some_word_4
And/or to one or more template files (eg:
backpage.html). Place the
custom_data_attributesbelow the dashes (
---) at the top of the file directly below where the layout is defined:
--- layout: default custom_data_attributes: - key_1 - key_2 - digital_fusion - foobar --- <!-- ...template code below here... -->
The attribute keys can be named anything you want and include spaces, but we reccommend avoiding crazy punctuation—treat them more like programming variables.
Data attributes defined in the
config.ymlwill be available to all pages. Attributes defined in a template will only be available to pages that are assigned that template, in addition to the global attributes defined in
- Maintain the data via the Custom Data tab on the Page Properties form.
- Consume the data via the
<r:page:data name="key_1"/>tag within your templates.
<r:page:data name="key_1" />
Sometimes, you may want page attributes, but you want them to be “global”. This is where Custom Site Data attributes are helpful. They follow most of the same rules as Custom Page Data. The only difference is that they cannot be defined via a template.
- Define the values in
custom_site_attributes: - site_1 - cal_code - special_id
- Call the Custom Site Data in your template:
<r:site:data name="site_1" />
- Once you have the values defined in
config.yml, push and sync your theme, then enter the data in Manage > Settings > Data:
Last updated on December 29, 2015.
We welcome all questions, feedback and bug reports. If you're having an issue, we usually need the following information:
- A brief description of the issue
- A link to the page where you saw the issue
- Screenshots that illustrate the problem - How do I take a screenshot?