-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
The tags feature page documentation suggests that the default for the tag page is Posts tagged ‘{{ tag }}’
, but if I use tags: {tagTitle: "Pages tagged ‘{{ tag }}’"}
in the plugin config, the page title ends up being Pages tagged ‘{{ tag }}’.
Looking at the implementation, this is because the default is using a template string, but options.tagTitle from options can only be a static string with this implementation.
Possible solutions:
- Allow passing functions into tagTitle:
and then the tagTitle could be specified as:
title: typeof options?.tagTitle === 'function' ? options?.tagTitle : (data) => options?.tagTitle || `Posts tagged ‘${data.tag}’`
tagTitle: (data) => `Pages tagged ‘${ data.tag }’`
- Use nunjucks to render the title:
Which would then work as currently documented.
title: (data) => nunjucks.renderString(options?.tagTitle || "Posts tagged ‘{{ tag }}’", data)
Happy to submit a PR for either option, please let me know which is preferred.
Metadata
Metadata
Assignees
Labels
No labels