Download

How to configure rendering process of your website?

Each Publii theme includes a special section, " renderer, " within its config.json file, dedicated to the rendering process.

In this section, you can specify which features are enabled, how many featured posts can be rendered, and more.

Below, we present all the available options for the rendering section, along with their default values. Note that within your theme's config.json, you only need to override the fields that require changes.

Default values for the renderer options

The default renderer options are following:

"renderer": {
        "relatedPostsNumber": 5,
        "renderRelatedPosts": true,
        "renderSimilarPosts": true,
        "renderPrevNextPosts": true,
        "createContentStructure": true,
        "includeFeaturedInPosts": true,
        "tagsIncludeFeaturedInPosts": true,
        "authorsIncludeFeaturedInPosts": true,
        "featuredPostsNumber": 0,
        "tagsFeaturedPostsNumber": 0,
        "authorsFeaturedPostsNumber": 0,
        "create404page": false,
        "createSearchPage": false,
        "createAuthorPages": true,
        "createTagPages": true,
        "customHTML": {
            "beforePost": "Before every post",
            "afterPost": "After every post"
        },
        "includeHandlebarsInHelpers": false
},

Available options

  • relatedPostsNumber - number of related posts which is displayed in the post page view
  • renderRelatedPosts - you can totally disable rendering of disabled posts if they are not used in your theme (it will speed up the rendering process)
  • renderSimilarPosts - if you are not using similar posts or prev/next posts in your post view, disable it to speed up the rendering process
  • renderPrevNextPosts - specify if the prev/next posts links should be rendered
  • createContentStructure - enable it only if you are using in your theme @website.contentStructure global variable - disabling it will speed up the rendering process. It cannot be overrided using Computed Options or custom options.
  • includeFeaturedInPosts - if you want to hide featured posts on the homepage posts listing - disable this option (it is especially useful if you want to avoid duplicated posts on listing and featured posts section).
  • tagsIncludeFeaturedInPosts - it works like includeFeaturedInPosts but for tag pages.
  • authorsIncludeFeaturedInPosts - it works like includeFeaturedInPosts but for author pages.
  • featuredPostsNumber - number of posts which are used to generate list of featured posts (-1 value displays all featured posts)
  • tagsFeaturedPostsNumber - it works like featuredPostsNumber but for tag pages (-1 value displays all featured posts)
  • authorsFeaturedPostsNumber - it works like featuredPostsNumber but for tag pages (-1 value displays all featured posts)
  • create404page - specify if the 404 error page should be created (using 404.hbs file). Please remember that if you want to override this settings using Computed Options - you need a theme with support for the 404 error pages.
  • createSearchPage - specify if the search page should be created (using search.hbs file). Output filename can be changed under URLs settings. Please remember that if you want to override this settings using Computed Options - you need a theme with support for the 404 error pages.
  • createAuthorPages - specify if the website will render author pages (using author.hbs file). Output filename can be changed under URLs settings. Please remember that if you want to override this settings using Computed Options - you need a theme with support for the 404 error pages.
  • createTagPages - specify if the website will render author pages (using tag.hbs file). Please remember that if you want to override this settings using Computed Options - you need a theme with support for the 404 error pages.
  • customHTML - it is an object which contains definitions of the custom HTML parts which can be rendered using @customHTML global variable
    global variable. It cannot be overrided using Computed Options or custom options.
  • includeHandlebarsInHelpers - specify if the Handlebars object will be available and passed to the functions in the helpers.js file. It cannot be overrided using Computed Options or custom options.

How to control renderer options from your theme settings UI?

You can control renderer options from the theme settings UI in a two ways:

  1. By overriding renderer options with the custom options which uses the same names. Then you create a custom option which directly replaces the renderer option.
  2. By using the Computed Options (if you want to create a more complex scenario where a few options value is used to specify a final value of the renderer option).

What are you waiting for?

Start building your site today.

  1. 1 Download Publii
  2. 2 Write your content
  3. 3 Publish your site
Create website