From 18c2c898aadabe1148df0aebcad33a0805c96f09 Mon Sep 17 00:00:00 2001 From: Drew Date: Fri, 25 Apr 2025 22:32:06 -0600 Subject: [PATCH] updates open graph data --- README.md | 12 ++++- config.toml | 2 +- layouts/_default/baseof.html | 51 ++++++++---------- .../images/{default-og.jpg => og-default.jpg} | Bin 4 files changed, 35 insertions(+), 30 deletions(-) rename static/images/{default-og.jpg => og-default.jpg} (100%) diff --git a/README.md b/README.md index 83edea3..ce31450 100644 --- a/README.md +++ b/README.md @@ -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. \ No newline at end of file +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.* \ No newline at end of file diff --git a/config.toml b/config.toml index c337624..0926139 100644 --- a/config.toml +++ b/config.toml @@ -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 = """ diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index a843579..08a39f7 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -15,7 +15,7 @@ {{ end }} - {{ $title }} + {{ $title }}{{ if .Params.narrator }} - {{ .Site.Title }}{{ end }} {{/* Generate description from summary, description, or default site description */}} {{ $description := "" }} @@ -36,52 +36,47 @@ {{ end }} + - {{ with .Params.images | default .Site.Params.images }} - - {{ end }} - {{ with .Site.Params.facebookAppID }} - + {{ with .Params.ogImage | default .Site.Params.openGraphImage }} + {{ end }} - {{ with .Params.images }} - + {{ with .Params.ogImage | default .Site.Params.openGraphImage }} + {{ end }} {{ if and .IsPage (eq .Type "articles") }} - - - - {{ with .Params.topics }} - {{ range . }} - - {{ end }} - - {{ end }} - - {{/* Author information using standard meta topics instead of article:author */}} - {{ with .Params.narrator }} - - {{ end }} - {{ with .Params.facilitator }} - - {{ end }} + + + + {{ with .Params.topics }} + {{ range . }} + + {{ end }} + {{ end }} + + {{/* Author information using standard meta topics instead of article:author */}} + {{ with .Params.narrator }} + + {{ end }} + {{ with .Params.facilitator }} + + {{ end }} {{ end }} - - {{ partial "css-variables.html" . }} - + {{ partial "css.html" . }} diff --git a/static/images/default-og.jpg b/static/images/og-default.jpg similarity index 100% rename from static/images/default-og.jpg rename to static/images/og-default.jpg