How can I display my Site Title alone as the Title for my homepage?

This is the most trivial thing, however, I have a homepage set with the metadata: Permalink: /and no matter whether or not I include (blank) Title: metadata, the page's title (in a browser tab) displays as '- [Site Title]'.

All my other pages display as '[Page Title] - [Site Title]', so I get that this is the page looking for a page title, not finding one, but leaving in the hyphen delimiter. Is there a way to stop it doing that, and just display the [Site Title]?

I can do it site wide by taking the '>' out of this line in head.html: <title>{{> title}}</title>, but that makes the title of every other page look weird.

Any and all suggestions appreciated.

2 replies

This is a good question, and the answer is a little complicated. You will want to edit the partial template title for the template file entry.html.

This partial is defined in your template's package.json file. Here is the line you would want to edit for the Diary template. Instead of this:

{{{entry.title}}} - {{{title}}}

Try this instead:

{{#entry.title}}{{{entry.title}}}  -{{/entry.title}} {{{title}}}

The change basically says: only show the hyphen and the entry's title if it the entry's title exists.

Does that fix the issue?

Answered 2 years ago · Improve this answer

Like an absolute charm! No more shall that rogue hyphen besmirch my homepage title bar. Thanks so much for this answer.

Answered 2 years ago · Improve this answer

Markdown allowed
Question or feedback?
Contact us

Tags

developers 28 questions bug 14 questions posts 9 questions resolved 7 questions request 6 questions google-drive 5 questions configure 4 questions pages 3 questions added 3 questions meta 3 questions More tags →
Subscribe for changes
RSS Feed of latest questions