🐛 Fixed error when rendering static page from dynamic route

no issue

- When having following routes.yaml configuation and theme runing API v3:
routes:
  /:
    data: page.home
    template: home

- There was an internall error in meta layer: `Cannot read property 'website' of undefined` which was caused by not being able to read primary_author on a fetched page
- We need to include authors and tags for pages, the same way we do for posts to prevent this error (as they should have identical properties from meta layer perspective)
This commit is contained in:
Nazar Gargol 2019-11-25 18:34:37 +07:00
parent f10a76e15a
commit 157820419a

View File

@ -11,7 +11,7 @@ function processQuery(query, locals) {
// the target resource. That means this static route has to behave the same way than the original resource url.
// e.g. the meta data package needs access to the full resource including relations.
// We override the `include` property for now, because the full data set is required anyway.
if (_.get(query, 'resource') === 'posts') {
if (_.get(query, 'resource') === 'posts' || _.get(query, 'resource') === 'pages') {
_.extend(query.options, {
include: 'authors,tags'
});