diff --git a/build.sbt b/build.sbt index 2a17a2e..c875d32 100644 --- a/build.sbt +++ b/build.sbt @@ -42,6 +42,13 @@ lazy val root = project("paradox-material-theme-parent", file(".")) } // #social , + // #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://www.scala-sbt.org/sbt-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..70f9a5e 100644 --- a/theme/src/main/assets/page.st +++ b/theme/src/main/assets/page.st @@ -27,6 +27,15 @@ $! + $ if (page.properties.("title")) $ + + $ endif $ + $ if (page.properties.("project.description")) $ + + $ endif $ + $ if (page.properties.("project.image")) $ + + $ endif $ $partials/language()$