gscan
gscan copied to clipboard
Unable to use {{#author}} in author-:slug.hbs
Issue Summary
I'm not able to use {{#author}} in an author-:slug.hbs file, due to that helper being deprecated.
The documentation here specifies that the {{#author}} helper can be used in author.hbs and author-:slug.hbs files.
If I activate the theme in Ghost, and then add the author-:slug.hbs file, bypassing the theme validator, the {{#author}} helper works as expected.
Steps to Reproduce
- Fork a theme (I'm using Casper)
- Create an author-:slug.hbs file. (
author-april.hbsfor example). - Upload to Ghost and attempt to activate, or use a GitHub action to process with Theme Validator. It fails due to
{{#author}}being deprecated.
Ghost Version
N/A
Node.js Version
N/A
How did you install Ghost?
Docker
Database type
MySQL 8
Browser & OS version
No response
Relevant log / error output
{
"name": "ThemeValidationError",
"context": null,
"type": "ThemeValidationError",
"details": {
"checkedVersion": "5.x",
"name": "casper",
"path": "/tmp/5b88c8f1-d260-4fbd-90c8-f0fff3a993fd",
"version": "5.4.1",
"errors": [
{
"fatal": true,
"level": "error",
"rule": "The <code>{{#author}}</code> block helper should be replaced with <code>{{#primary_author}}</code> or <code>{{#foreach authors}}...{{/foreach}}</code>",
"details": "The usage of <code>{{#author}}</code> block helper outside of <code>author.hbs</code> is no longer supported andshould be replaced with <code>{{#primary_author}}</code> or <code>{{#foreach authors}}...{{/foreach}}</code>.<br>Ghost allows multiple authors to be assigned to a post, so all helpers have been reworked to account for this.<br>Find more information about the <code>{{authors}}</code> helper <a href=\"https://ghost.org/docs/themes/helpers/authors/\" target=_blank>here</a>",
"regex": {},
"notValidIn": "author.hbs",
"helper": "{{#author}}",
"failures": [
{
"ref": "author-april.hbs",
"message": "Please remove or replace {{#author}} from this template"
}
],
"code": "GS001-DEPR-AUTHBL"
}
]
},
"property": null,
"help": null,
"code": null,
"id": "e640bd60-63e0-11ed-8f1c-470fc967c6af",
"ghostErrorCode": null
}
Code of Conduct
- [X] I agree to be friendly and polite to people in this repository
Hey there, thank you so much for the detailed bug report.
That does look like something that shouldn't happen! A PR to fix this issue would be very welcome, although it's a fairly tricky thing to fix 🙂
FYI I've moved this over to the gscan repo, as it's the gscan that's detecting the error in the custom author template when it shouldn't.