From fc5fb68cdc2015436483d1ff9648a23cf26805e2 Mon Sep 17 00:00:00 2001 From: Jonas Chapuis Date: Thu, 25 Nov 2021 13:40:01 +0100 Subject: [PATCH 1/4] Add open-graph tags support --- build.sbt | 9 ++++++++- src/main/paradox/getting-started.md | 6 ++++++ theme/src/main/assets/page.st | 9 +++++++++ 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 2a17a2e..d7f8522 100644 --- a/build.sbt +++ b/build.sbt @@ -42,7 +42,14 @@ lazy val root = project("paradox-material-theme-parent", file(".")) } // #social , - // #language + // #open-graph + Compile / paradoxProperties ++= Map( + "project.description" -> "Paradox Material Theme is a theme for Paradox, a static site generator geared towards project documentation", + "project.image" -> "https://jonas.github.io/paradox-material-theme/images/material.png" + ) + //#open-graph + , + //#language Compile / paradoxMaterialTheme ~= { _.withLanguage(java.util.Locale.ENGLISH) } diff --git a/src/main/paradox/getting-started.md b/src/main/paradox/getting-started.md index cd82a62..a0fb43b 100644 --- a/src/main/paradox/getting-started.md +++ b/src/main/paradox/getting-started.md @@ -225,6 +225,12 @@ on the URL: [17]: http://fontawesome.io/icons/ +## Open graph metadata +To enable a nice preview of the site in social media, define the +following properties in the build: + +@@ snip [build.sbt]($root$/build.sbt) { #open-graph } + ## Copyright Notice To display a copyright notice in the footer configure the diff --git a/theme/src/main/assets/page.st b/theme/src/main/assets/page.st index 7a9c30c..99918e7 100644 --- a/theme/src/main/assets/page.st +++ b/theme/src/main/assets/page.st @@ -27,6 +27,15 @@ $! + $ if (page.properties.("project.name")) $ + + $ endif $ + $ if (page.properties.("project.description")) $ + + $ endif $ + $ if (page.properties.("project.image")) $ + + $ endif $ $partials/language()$ From 0052e7b350e8c684ef67acc48d936369e1f898b1 Mon Sep 17 00:00:00 2001 From: Jonas Chapuis Date: Thu, 15 Feb 2024 10:28:52 +0200 Subject: [PATCH 2/4] Reformatting --- build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sbt b/build.sbt index d7f8522..5b4ce91 100644 --- a/build.sbt +++ b/build.sbt @@ -47,9 +47,9 @@ lazy val root = project("paradox-material-theme-parent", file(".")) "project.description" -> "Paradox Material Theme is a theme for Paradox, a static site generator geared towards project documentation", "project.image" -> "https://jonas.github.io/paradox-material-theme/images/material.png" ) - //#open-graph + // #open-graph , - //#language + // #language Compile / paradoxMaterialTheme ~= { _.withLanguage(java.util.Locale.ENGLISH) } From 1737c444e197f434ddd8ab550cec6e9abddecef2 Mon Sep 17 00:00:00 2001 From: Jonas Chapuis Date: Thu, 15 Feb 2024 23:17:49 +0200 Subject: [PATCH 3/4] Update project.image url --- build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 5b4ce91..c875d32 100644 --- a/build.sbt +++ b/build.sbt @@ -45,7 +45,7 @@ lazy val root = project("paradox-material-theme-parent", file(".")) // #open-graph Compile / paradoxProperties ++= Map( "project.description" -> "Paradox Material Theme is a theme for Paradox, a static site generator geared towards project documentation", - "project.image" -> "https://jonas.github.io/paradox-material-theme/images/material.png" + "project.image" -> "https://www.scala-sbt.org/sbt-paradox-material-theme/images/material.png" ) // #open-graph , From 3e7746334f3d7d0ca7ebcbbdc90d9aec605c5935 Mon Sep 17 00:00:00 2001 From: Jonas Chapuis Date: Tue, 27 Feb 2024 13:27:32 +0100 Subject: [PATCH 4/4] Use title property instead of project name for `og:title` --- theme/src/main/assets/page.st | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/theme/src/main/assets/page.st b/theme/src/main/assets/page.st index 99918e7..70f9a5e 100644 --- a/theme/src/main/assets/page.st +++ b/theme/src/main/assets/page.st @@ -27,8 +27,8 @@ $! - $ if (page.properties.("project.name")) $ - + $ if (page.properties.("title")) $ + $ endif $ $ if (page.properties.("project.description")) $