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

add meta description for google lighthouse #121

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions archetypes/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
description:
comments: false
images:
---
Expand Down
1 change: 1 addition & 0 deletions archetypes/posts.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
description:
toc: false
images:
tags:
Expand Down
1 change: 1 addition & 0 deletions layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<meta name="theme-color" content="{{.}}">
<meta name="msapplication-TileColor" content="{{.}}">
{{- end }}
<meta name="description" content="{{.Description | default .Site.Params.Description}}">
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of putting this in baseof.html, it's better placing this inside layouts/partials/structured-data.html.

As for code inside content attribute, I think we can refer to Hugo internal templates here:
https://github.com/gohugoio/hugo/blob/fc0f13b68451a09a6d6b4ce50c4217313b664176/tpl/tplimpl/embedded/templates/schema.html#L2

it covers more cases

{{ with .Description }}{{ . }}{{ else }}{{if .IsPage}}{{ .Summary }}{{ else }}{{ with .Site.Params.description }}{{ . }}{{ end }}{{ end }}{{ end -}}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, sorry for the late reply I do not work on my blog that often...

I checked your message and we are already impprting this schema.html template in our layouts/partials/structured-data.html:

{{- template "_internal/schema.html" . }}
{{- template "_internal/opengraph.html" . }}
{{- template "_internal/twitter_cards.html" . }}

Hence, I have no idea what you mean. The problem seem to be that the schema.html template from the _internall hugo library uses itemprop instead of name in the meta tag... and that's why it doesn't get recognized, because itemprop seem to be for social media stuff only.

{{- partial "structured-data.html" . }}
{{- partial "favicons.html" }}
<title>{{.Title}}</title>
Expand Down