Dynamic routing - page/post data context in default.hbs + nested navigation on custom collections


I’ve just started developing a theme and have run into a problem that has been raised before.

This is the referenced issue in Github.

The version of Ghost I’m running is 2.6.1.

This is my routes.yaml file.

  /: home
      page: page.about
      - about

    permalink: /news/{slug}/
      page: page.news
      - news

  tag: /tag/{slug}/
  author: /author/{slug}/

In the admin I have static pages set up with slugs about and news. I would like to use these to manage things like the page title, meta title, meta description, social card information, etc. However as the previous topic suggests the page data is not coming through in context. The {{meta_title}} for the /about/ route is the blog title, and for the /news/ collection it’s the blog title with the pagination information appended, e.g. (Page 1). Strangely though the {{meta_description}} property is being populated in the template correctly.

That’s the first query/issue.

The second is that the {{current}} helper in the {{navigation}}. I have /news/ as one of my navigation items which for the listing page correctly adds the nav-current class, however for the nested posts /news/{slug}/ it is not set. Is it possible to do this?

Thanks in advance!


I have the same issue.
can not change title when use custom collections

permalink: /product/{slug}/
filter: tag:[product]
data: page.tmp-product

the web title show “site-name Page1"

closed #3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.