updates open graph data

This commit is contained in:
Drew 2025-04-25 22:32:06 -06:00
parent 451e860697
commit 18c2c898aa
4 changed files with 35 additions and 30 deletions

View File

@ -51,4 +51,14 @@ links:
- text: "My Twitter"
url: "https://twitter.com/example"
```
This will include the links in the article page. The links will be displayed as a list with the text as the link text and the URL as the link target.
This will include the links in the article page. The links will be displayed as a list with the text as the link text and the URL as the link target.
### Open Graph Image
You can add Open Graph image (for social media sharing) to an article. To do this, add a `ogImage` field to the front matter of the article. The value should be the path to the image file. For example:
```yaml
ogImage: "/images/my-image.jpg"
```
*Note: The image should be at least 1200x630 pixels for best results. Make sure to place the image in `/static/images/` directory so it can be served correctly. The path should be relative to the static directory.*

View File

@ -12,7 +12,7 @@ title = 'Protocol Oral History Project'
[params]
description = "The Protocol Oral History Project chronicles the development of internet protocols and standards through interviews with key contributors."
images = ["/images/default-og.jpg"] # Will be replaced by wompum generation
openGraphImage = "/images/og-default.jpg"
twitterSite = ""
facebookAppID = ""
footer = """

View File

@ -15,7 +15,7 @@
{{ end }}
<!-- Basic SEO -->
<title>{{ $title }}</title>
<title>{{ $title }}{{ if .Params.narrator }} - {{ .Site.Title }}{{ end }}</title>
{{/* Generate description from summary, description, or default site description */}}
{{ $description := "" }}
@ -36,52 +36,47 @@
{{ end }}
<!-- Open Graph / Facebook -->
<meta property="og:site_name" content="{{ .Site.Title }}" />
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:title" content="{{ $title }}" />
<meta property="og:description" content="{{ $description }}" />
{{ with .Params.images | default .Site.Params.images }}
<meta property="og:image" content="{{ index . 0 | absURL }}" />
{{ end }}
{{ with .Site.Params.facebookAppID }}
<meta property="fb:app_id" content="{{ . }}" />
{{ with .Params.ogImage | default .Site.Params.openGraphImage }}
<meta property="og:image" content="{{ . | absURL }}" />
{{ end }}
<!-- Twitter -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="{{ $title }}" />
<meta name="twitter:description" content="{{ $description }}" />
{{ with .Params.images }}
<meta name="twitter:image" content="{{ index . 0 | absURL }}" />
{{ with .Params.ogImage | default .Site.Params.openGraphImage }}
<meta name="twitter:image" content="{{ . | absURL }}" />
{{ end }}
<!-- Article Specific -->
{{ if and .IsPage (eq .Type "articles") }}
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" />
<meta property="article:section" content="Oral History" />
{{ with .Params.topics }}
{{ range . }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}
{{/* Author information using standard meta topics instead of article:author */}}
{{ with .Params.narrator }}
<meta name="author" content="{{ . }}" />
{{ end }}
{{ with .Params.facilitator }}
<meta name="interviewer" content="{{ . }}" />
{{ end }}
<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}" />
<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05Z07:00" }}" />
<meta property="article:section" content="Oral History" />
{{ with .Params.topics }}
{{ range . }}
<meta property="article:tag" content="{{ . }}" />
{{ end }}
{{ end }}
{{/* Author information using standard meta topics instead of article:author */}}
{{ with .Params.narrator }}
<meta name="author" content="{{ . }}" />
{{ end }}
{{ with .Params.facilitator }}
<meta name="interviewer" content="{{ . }}" />
{{ end }}
{{ end }}
<!-- Canonical URL -->
<link rel="canonical" href="{{ .Permalink }}" />
<!-- CSS Variables and Styles -->
{{ partial "css-variables.html" . }}
<!-- CSS Styles -->
{{ partial "css.html" . }}
</head>
<body class="">

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB