@andrianov as an aside, I want to add that your Forum Profile Picture . . .
. . . is absolutely adorable!
( . . . and it seems to accurately express your attitude toward this annoying problem . . . )
@andrianov as an aside, I want to add that your Forum Profile Picture . . .
. . . is absolutely adorable!
( . . . and it seems to accurately express your attitude toward this annoying problem . . . )
Thank you for the appreciation.
Iām not giving up hope that the problem will be solved.
Seriously, I canāt understand why no one can explain how to make a proper copy of the template for the author? And why Ghost tells me itās not right to use {{#author}} although it works correctly.
Hi @andrianov Iām having the exact same problem.
The frustrating thing is, I canāt upgrade Ghost to v5 because GScan fails during the upgrade
We could potentially just make static pages/templates for each author, but thatās not an elegant solution. I really want to use the Author object because it is nice being able to pull in data from author profiles.
Did you have any luck with this?
According to the Ghost docs on the post helper, it seems that {{#primary_author}}
can only be used on a page or post that actually has an author. The author pages do not technically have authors, which would explain why we canāt access any of its properties.
The block expression
{{#post}}{{/post}}
isnāt strictly a āhelperā. You can do this with any object in a template to access the nested attributes e.g. you can also use{{#primary_author}}{{/primary_author}}
inside of the post block to get to the primary authorās name and other attributes.
In my case my workaround was to revert back to using an author.hbs
template and simply using the {{#author}}
block to display the properties I need inside it.
I hope this helps anyone having the same issue.
I ended up here on this post far later than to be helpful to anyone above, but in case someone else with this issue happens by, I figured I should post the solution!
Basically I think itās easy to read this (in Ghostās README):
One neat trick is that you can also create custom one-off templates just by adding the slug of a page to a template file. For example:
- author-ali.hbs - Custom template for /author/ali/ archive
And think that all one needs to do is to duplicate author.hbs
, rename it as e.g. author-ali.hbs
, and expect everything to work. And it does work locally, until you try to upload it as a theme, where it gets rejected with this message about the {{#author}}
block no longer being supported outside of author.hbs
.
Apparently the {{#author}}
block was restricted in this way when Ghost refactoring was done to allow for multiple post authors. And since author pages are specialātechnically lacking an author (in the sense theyāre not a post)āthe theme activation error suggestions for replacing with {{primary_author}}
or {{foreach authors}}
will fail.
Hereās the solution for dealing with a one-off author-based template (in this example, author-ali.hbs
:
Replace:
{{author}}
ā¦
{{/author}}
With (note: make sure to replace ali
with your custom slug):
{{#get 'authors' filter='slug:ali'}}
{{#foreach authors}}
ā¦
{{/foreach}}
{{/get}}