One of the things that I have had to get my head around since switching to Ghost is the new way of customising my website. I really hated writing in php but I got used to customising things pretty easily. Ghost themes use the Handlebars templating language which I had to pick up through lots of web searches.
Now that I have sorted out displaying my link posts correctly, I now wanted to exclude them from my index and put them only on their own page, similar to how I did it on WordPress. Thankfully this is pretty easy and requires minimal code knowledge.
In index.hbs find where it calls the #foreach posts
and add in a line above {{#get “posts” filter=“tags:-[tag 1,tag 2]”}}
.
So in my case I want to just exclude link posts which are all tagged ‘links’ – I did the following.
{{#get “posts” filter=“tags:-[links]”}}
{{#foreach posts}}
{{!— The tag below includes the markup for each post - partials/post-card.hbs —}}
{{> “post-card”}}
{{/foreach}}
{{/get}}
Your theme will look different to the above but the placement will be the same. This means that all of the relevant posts are missed in your index loop.
Update 19/02/2020: You can also achieve this by adding in a filter to your routes.ymal file. download your original file from Labs in yiour control panel, then add in your filter.
collections:
/:
permalink: /{slug}/
template: index
filter: tag:-[tag you want to remove]
Upload this back to your control pannel and your index is now filtered. For more infomation see Ghost docs.