Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Title tag not rendered on Index page #35

Open
daemotron opened this issue Jan 3, 2023 · 0 comments
Open

Title tag not rendered on Index page #35

daemotron opened this issue Jan 3, 2023 · 0 comments

Comments

@daemotron
Copy link

On the root index.html, the title tag within the head remains empty.

<!doctype html>
<html lang=en>
<head>
<meta name=generator content="Hugo 0.109.0">
<meta charset=utf-8>
<meta http-equiv=x-ua-compatible content="ie=edge">
<meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no">
<title></title>

On blog posts it's filled correctly - this behaviour can also be observed on the sample site (https://hugo-theme-puppet.netlify.app/)

One possible solution: Add a title property (matching the site's title) to the front matter of _index.md in the root of content (https://github.com/roninro/hugo-theme-puppet/blob/master/exampleSite/content/_index.md).

Another possible solution would be to adapt the conditional in baseof.html and add a case for .IsHome, setting $title to .Site.Title:

{{ $title := .Title }}
{{- if not .IsHome }}
    {{ $title = printf "%s | %s" .Title .Site.Title }}
{{ else }}
    {{ $title = printf "%s" .Site.Title }}
{{ end -}}

<title>{{ $title }}</title>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant