Skip to content

Instantly share code, notes, and snippets.

@osecluna
Created September 23, 2019 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save osecluna/0db637e8febc8143daa6a1415eb923c6 to your computer and use it in GitHub Desktop.
Save osecluna/0db637e8febc8143daa6a1415eb923c6 to your computer and use it in GitHub Desktop.

First add the schema

Now add the content type

Finally add the handlebars template, which will be used to generate the HTML via the Content Rendering Service:

  • Save simpleblog.html into a local file
  • Login to Amplience Content Hub
  • Upload the new template simpleblog.html
  • Publish the template
{
"$schema": "http://bigcontent.io/cms/schema/v1/schema#",
"id": "http://example.com/blogpost-algolia-demo.json",
"title": "Simple Blog Post",
"description": "Blog Post",
"allOf": [
{
"$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/content"
}
],
"propertyOrder": [
"title",
"description",
"content",
"snippet"
],
"type": "object",
"properties": {
"title": {
"type": "string",
"minLength": 0,
"maxLength": 255,
"title": "Title",
"description": ""
},
"description": {
"type": "string",
"minLength": 0,
"maxLength": 500,
"title": "Description",
"description": ""
},
"content": {
"title": "Content",
"description": "content",
"type": "string",
"format": "markdown"
},
"snippet": {
"type": "object",
"title": "Snippet",
"description": "",
"properties": {
"image":{
"title": "image",
"description": "image",
"allOf": [
{ "$ref": "http://bigcontent.io/cms/schema/v1/core#/definitions/image-link" }
]
},
"title": {
"type": "string",
"minLength": 0,
"maxLength": 255,
"title": "Snippet Title",
"description": ""
},
"description": {
"type": "string",
"minLength": 0,
"maxLength": 500,
"title": "Snippet Description",
"description": ""
}
}
}
}
}
<div>{{{description}}}</div>
{{#if image}}<img
src="https://{{image.defaultHost}}/i/{{image.endpoint}}/{{encodeURI image.name}}?w=760"
{{#if imageAltText}} alt="{{imageAltText}}" {{/if}}/>{{/if}}
<div>{{{content}}}</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment