Log in Sign up

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 Asked Jul 21 '21 at 13:55 · Improve this question

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 Jul 21 '21 at 19:39 · 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 Jul 22 '21 at 8:43 · Improve this answer

Please, log in to add a reply.