From 1efce0f1c5cdffae9b5c5c65736a6de3b14b9d01 Mon Sep 17 00:00:00 2001
From: Alexander Bilz <mail@alexbilz.com>
Date: Tue, 30 Jun 2020 18:22:29 +0000
Subject: [PATCH] 🦉 Added support for Twitter Cards

---
 exampleSite/config.toml                          |    1 +
 layouts/partials/head.html                       |    1 +
 exampleSite/static/images/site-feature-image.png |    0 
 README.md                                        |   15 +++++++++++++++
 4 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md
index ea9e9f6..768cb92 100644
--- a/README.md
+++ b/README.md
@@ -18,6 +18,7 @@
 - Google Analytics (optional)
 - Comments powered by Disqus (optional)
 - Katex support (optional)
+- Twitter Cards support
 - MIT License
 - Fontawesome icons
 - Custom CSS (optional)
@@ -104,6 +105,20 @@
 use = "katex"  # options: "katex", "mathjax". default is "katex".
 ```
 
+### Twitter Cards support
+In order to use the full functionality of Twitter cards, you will have to define a couple of settings in the `config.toml` and the frontmatter of a page.
+
+In the `config.toml` you can configure a site feature image. This image will be displayed, if no image is defined in the frontmatter of a page.
+```toml
+[params]
+  images = ["images/site-feature-image.png"]
+```
+To define a custom image of a page, you might want to add the following to the frontmatter of a post.
+```toml
+images = ["post-cover.png"]
+```
+
+
 ### Custom CSS
 You can add your custom CSS files with the `customCss` parameter of the configuration file. Put your files into the `static/css` directory.
 
diff --git a/exampleSite/config.toml b/exampleSite/config.toml
index 29ae9e3..9e729db 100644
--- a/exampleSite/config.toml
+++ b/exampleSite/config.toml
@@ -21,6 +21,7 @@
 favicon = "favicons/"
 customCss = []
 mainSections = ["post"]
+images = ["images/site-feature-image.png"]
 
 ## Math settings
 [params.math]
diff --git a/exampleSite/static/images/site-feature-image.png b/exampleSite/static/images/site-feature-image.png
new file mode 100644
index 0000000..450269e
--- /dev/null
+++ b/exampleSite/static/images/site-feature-image.png
Binary files differ
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index a43a419..aaecefc 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -19,4 +19,5 @@
     {{ $anatole := resources.Get "js/anatole-header.js" }}
     {{ $secureJS := $anatole |  resources.Minify | resources.Fingerprint }}
     <script type="text/javascript" src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}" crossorigin="anonymous"></script>
+    {{ template "_internal/twitter_cards.html" . }}
 </head>
\ No newline at end of file

--
Gitblit v1.10.0