-
Notifications
You must be signed in to change notification settings - Fork 402
Add opengraph metadata to theme #137
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
Conversation
Allows for embeds (on discord and others) to work
|
🚀 Draft Preview: http://pr137.drafts.lczero.org/ |
|
🚀 Draft Preview: http://pr137.drafts.lczero.org/ |
config.toml
Outdated
| meta_og_title = "Leela Chess Zero" | ||
| meta_og_type = "website" | ||
| meta_og_url = "https://lczero.org" | ||
| meta_og_image = "https://raw.githubusercontent.com/JugglerX/hugo-whisper-theme/master/images/tn.png" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what meta_og_image is, but likely we don't what this particular image?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds Open Graph and Twitter metadata to the site’s head for better embeds and SEO
- Introduces a new
opengraph.htmlpartial with various OG/Twitter tags - Injects the new partial into the main
head.htmllayout - Updates site parameters in
config.tomland refines the blog index title
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| themes/leela/layouts/_partials/head/opengraph.html | New partial defining Open Graph and Twitter meta tags |
| themes/leela/layouts/_partials/head.html | Includes the head/opengraph.html partial |
| content/blog/_index.md | Refines the blog section’s title |
| config.toml | Enables and configures homepage_meta_tags params |
| {{- with or site.Title site.Params.title | plainify }} | ||
| <meta property="og:site_name" content="{{ . }}"> | ||
| {{- end }} | ||
|
|
||
| {{- with or .Title site.Title site.Params.title | plainify }} |
Copilot
AI
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template uses site.Title and site.Params.title without the leading dot, so Hugo won’t resolve these. Update to .Site.Title and .Site.Params.title to correctly reference site parameters.
| {{- with or site.Title site.Params.title | plainify }} | |
| <meta property="og:site_name" content="{{ . }}"> | |
| {{- end }} | |
| {{- with or .Title site.Title site.Params.title | plainify }} | |
| {{- with or .Site.Title .Site.Params.title | plainify }} | |
| <meta property="og:site_name" content="{{ . }}"> | |
| {{- end }} | |
| {{- with or .Title .Site.Title .Site.Params.title | plainify }} |
| <meta property="og:site_name" content="{{ . }}"> | ||
| {{- end }} | ||
|
|
||
| {{- with or .Title site.Title site.Params.title | plainify }} |
Copilot
AI
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace site.Title with .Site.Title here to ensure the site title is properly referenced in the OG title and avoid template errors.
| {{- with or .Title site.Title site.Params.title | plainify }} | |
| {{- with or .Title .Site.Title site.Params.title | plainify }} |
| @@ -0,0 +1,81 @@ | |||
| {{/* Source: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_partials/opengraph.html */}} | |||
| <meta property="og:url" content="{{ .Site.Params.homepage_meta_tags.meta_og_url }}"> | |||
Copilot
AI
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The OG image meta tag is missing; add <meta property="og:image" content="{{ .Site.Params.homepage_meta_tags.meta_og_image }}"> after this line so social previews include the configured image.
| <meta property="og:url" content="{{ .Site.Params.homepage_meta_tags.meta_og_url }}"> | |
| <meta property="og:url" content="{{ .Site.Params.homepage_meta_tags.meta_og_url }}"> | |
| <meta property="og:image" content="{{ .Site.Params.homepage_meta_tags.meta_og_image }}"> |
|
🚀 Draft Preview: http://pr137.drafts.lczero.org/ |
Allows for embeds (on discord and others) to work, also helps with SEO