Disable backlinks for Pages, but keep them for Posts?
I have an "about" Page, and a Post that links to it. At the bottom of the "about" Page, there is the Links here/backlinks section that appears at the bottom of regular Posts. I’d like to disable this for Pages, but keep it for Posts.
I had a look through the entry.html template, and I can see the section that adds backlinks right above the section that adds pagination. Pagination is not shown on Pages, but backlinks are, but to my untrained eye, I don't see a difference between the way the sections for backlinks/pagination are set up in the template.
Not sure if this is the “best” way, but I accomplished this by adding custom metadata disablebacklinks: yes
to all of the pages I didn't want to see backlinks on.
Then, in my entry.html
template, I wrapped the backlinks section in {{^metadata.disablebacklinks}}, {{/metadata.disablebacklinks}}
so that backlinks will not render on any page with that metadata present.
I use front-matter property "unlinked:" for the pages I don't want to show backlinks for. The property is picked up by entry.html template in the following way
{{^metadata.unlinked}}
{{#backlinks.length}}
{{#backlinks}}
<...>
{{/backlinks}}
{{/backlinks.length}}
{{/metadata.unlinked}}
for example this: https://lev.lc/no%20random%20for%20you.md turns into that: https://lev.lc/random
You may use the similar approach but with the {{^metadata.page}}
, as long as you don't use "Page: No" for some reason...