Templates System

The Superdesk Publisher templates system has its own git repository, at: https://github.com/SuperdeskWebPublisher/templates-system

Templates inheritance

Default template name for route and articles in Publisher is article.html.twig.

Inheritance overview:

1
2
3
> article.html.twig
    > Route custom template
        > Article custom template

If route is collection type then it can have declared two default templates:

  • default_template used for rendering Route content (eg. /sport).
  • default_articles_template used for rendering content attached to this route (eg. /sport/usain-bolt-fastest-man-in-theo-world).

Note

When route default_template property is set but not default_articles_template, then Web Publisher will load all articles attached to this route with template chosen in default_template (not with article.html.twig).

If content have assigned custom template then it will always override other already set templates.

How to change the Route/Article template name?

You can change default template name values for article and route either in routes management, or with API calls (providing it on resource create or resource update calls).

Example resource update calls:

article:

1
curl -X "PATCH" -d "article[template_name]=new_template_name.html.twig" -H "Content-type:\ application/x-www-form-urlencoded" /api/v1/content/articles/features

route:

1
curl -X "PATCH" -d "route[template_name]=custom_route_template.html.twig" -H "Content-type:\ application/x-www-form-urlencoded" /api/v1/content/routes/news