Brightspot CMS Developer Guide

Generating data files from published content


You can generate a data file from published content by appending ?_renderer=styleguide to the item’s URL. For example, loading an article http://<host>/deadly-gamma-ray-burst-headed-for-mannys-pizzeria?_renderer=styleguide displays the JSON representation of the article’s content used to populate a template.

{
  "_exampleOnly" : true, 
  "_template" : "/core/article/ArticlePage.hbs", 
  "articleBody" : [ { 
      "_template" : "/core/article/RichTextArticleBody.hbs",
      "body" : [ "{{html('<p>Asteroid 31415626, known more popularly as \"Fuzzy Bunny,\" escaped its orbit last month and is expected to collide with the Earth on January 21, 2025--precisely one week before the long-anticipated wedding between Jocelyn Rodriguez and Chas O'Brien. The bride-to-be isn't flustered by this development, and asked her bridesmaids to shop for dresses that coordinate well with pulverized concrete and lingering dust clouds.</p>')}}" ],
      "isCached" : false
  } ],
  "datePublished" : "September 05, 2018 09:32 AM",
  "headline" : "Massive Rogue Asteroid On Course to Disrupt Nuptials"
}
  • Indicates this JSON file is not for production purposes. Brightspot ignores this file when creating views.
  • Indicates the template used to render the content.
  • Array of content keys and associated values taken from a published article.

You can use this file to debug templates and formatting. The advantage to this approach is that you can view your templates with live, published content instead of the mock data in data files—allowing for faster development and deployment.

To render a published data file in Styleguide:

  1. Copy/paste the rendered JSON file in a theming directory.

    • Leave a blank line at the end of the JSON file.
    • Don’t overwrite any existing files.
  2. View the data file in Styleguide. For information about where you can find the template in the Styleguide UI, see Template listing.

The following examples show the difference between two published data files, one rendered in Styleguide, another rendered in production by Brightspot.

Published content rendered in Styleguide.png
Published content rendered in Styleguide
Published content rendered by Brightspot.png
Published content rendered by Brightspot

See also:

Previous Topic
Reusing data files
Next Topic
How the view generator creates view classes
Was this topic helpful?
Thanks for your feedback.