Sure. I thought I already did, but if you want the whole story, I can tell you
It might help anybody else who’s looking for a similar or same solution to their blog situation.
My ultimate goal is:
I have 3 WP blogs I’d like to merge into one site, and I’d like to try Ghost to do this.
Each blog will have their own content collection, tagged with an internal tag.
In the theme of the index.hsb
file of my theme, I can change from showing the @site.title
to meta_title
and the @site.description
to meta_description
that I’ve set for each internal tag.
This works great, btw and I love that it’s included with ghost. With WP you have to struggle with major plugins to get the same results or pay dearly for self-hosting. WP.com does not offer it at all with the free plan either.
On the front page, home.hbs
I want to have a landing page, showing a link to each content collection, and I’ve created a page for each content collection to do so. In my routes.yaml
file I’ve set the data attribute to get data from those pages. This works, but creating links to an internal tag does not, so that’s why I’ve created pages for this to work.
At each content collection’s individual post, I’d like the <title>
to look like this, so the browser tab displays both the post title and the internal tag/data page fetches it and it looks more like if it was a separate blog, rather than a post of a blog with multiple categories. This is what I want:
<title> post title | tag.meta_title</title>
.
I’ve solved the title thing a little, with your tip on using the contentFor
block. Now my <title>
tag in default.hbs
looks like this:
<title>{{meta_title}} {{#is "post"}} | {{block "internalTag"}}{{/is}}</title>
The issue I’m having now is that I’d like to have a more dynamic solution, like mentioned in previous post. I’ll share it again for clarity:
This is my current solution:
{{#contentFor "internalTag"}}
{{#has tag="#tagOne"}}
Content collection tag title in plain text
{{else has tag="#tagTwo"}}
Content collection tag title in plain text
{{else has tag="#tagThree"}}
Content collection tag title in plain text
{{/has}}
{{/contentFor}}
I don’t really know how the {{#has}}
helper works, because I have not found anything about it online, except for all the tutorials and docs on the ghost page. I’d like to have my contentFor
block look like this instead:
{{#contentFor "internalTag"}}
{{#has tag="#tagOne, #tagTwo, #tagThree"}}
{{tag.meta_title}}
{{/has}}
If I only write meta_title
in this way, I get the site title instead and that’s not what I want. Am I supposed to just write {{name}}
instead, to get the tag’s name/meta_title
?
I hope this was really thourough, because I don’t know how to explain my goals in any other way.
Thank you for any help.