danurbanowicz / eleventy-netlify-boilerplate

A template for building a simple website with the Eleventy static site generator

Home Page:https://eleventy-netlify-boilerplate.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Default title for tag page

spekulatius opened this issue · comments

Hello @danurbanowicz

I was wondering if you could give me a hint on how to change the default title for the tag pages. I've tried to add different versions of "title" to the front of the tags.njk-file but non succeeded.

Cheers,
Peter

Page titles are set in _includes/components/head.njk

Currently it just pulls in the default site title from data/metadata.json

Assuming you want to output some text and then the tag name as your page title, you need to use the renderData method in your tags.njk front matter, something like this:-

renderData:
  title: "Posts tagged: {{ tag | capitalize }}"

Then in _includes/components/head.njk you can do the following to use it if it's a tag page:-

<title>{{ renderData.title or title }}</title>

Sorry it's a rushed explanation, I will try to get a PR done soon to implement this as default behaviour.

Fixed by PR #15

ezoic increase your site revenue