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" - text: "My Twitter"
url: "https://twitter.com/example" 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] [params]
description = "The Protocol Oral History Project chronicles the development of internet protocols and standards through interviews with key contributors." 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 = "" twitterSite = ""
facebookAppID = "" facebookAppID = ""
footer = """ footer = """

View File

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

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB