Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use {{#author}} in author-:slug.hbs #457

Open
1 task done
SkippyTheLost opened this issue Nov 14, 2022 · 1 comment
Open
1 task done

Unable to use {{#author}} in author-:slug.hbs #457

SkippyTheLost opened this issue Nov 14, 2022 · 1 comment
Labels

Comments

@SkippyTheLost
Copy link

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

  1. Fork a theme (I'm using Casper)
  2. Create an author-:slug.hbs file. (author-april.hbs for example).
  3. 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

  • I agree to be friendly and polite to people in this repository
@ErisDS ErisDS added the bug label Nov 15, 2022
@ErisDS ErisDS transferred this issue from TryGhost/Ghost Nov 15, 2022
@ErisDS
Copy link
Member

ErisDS commented Nov 15, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants