Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zwbetz-gh/minimal-bootstrap-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlok G Singh <alephnull@gmail.com>2019-10-01 07:59:43 +0300
committerzwbetz-gh <37317628+zwbetz-gh@users.noreply.github.com>2019-10-01 07:59:43 +0300
commit341eb1eb1c90b09f33d46104fa2477b80eedc83d (patch)
treede8fc9ad2edbf6ac7dbb4d51905eb3adccfbe4bf
parent0c4285641b8341114d300b9089b3a80816fbcd24 (diff)
Added mastodon shortcode (#8)
-rw-r--r--README.md13
-rw-r--r--layouts/_default/baseof.html3
-rw-r--r--layouts/partials/mastodon-js.html3
-rw-r--r--layouts/shortcodes/mastodon.html9
4 files changed, 27 insertions, 1 deletions
diff --git a/README.md b/README.md
index f6e864f..d66c549 100644
--- a/README.md
+++ b/README.md
@@ -22,6 +22,7 @@ A minimal hugo theme made with bootstrap that focuses on content readability.
- [`imgAbs`](#imgabs)
- [`imgRel`](#imgrel)
- [`imgProc`](#imgproc)
+ - [`mastodon`](#mastodon)
- [Getting help](#getting-help)
- [Stackbit Deploy](#stackbit-deploy)
@@ -157,6 +158,18 @@ class="some-class"
style="some-style" >}}
```
+### `mastodon`
+
+This will embed a toot in an `iframe`.
+
+These arguments are optional: `width`, `height`.
+
+```
+{{% mastodon
+status="https://mastodon.social/@kevingimbel/100700713283716694"
+width="1000" height="500" %}}
+```
+
## Getting help
If you run into an issue that isn't answered by this documentation or the [`exampleSite`](https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme/tree/master/exampleSite), then visit the [Hugo forum](https://discourse.gohugo.io/). The folks there are helpful and friendly. **Before** asking your question, be sure to read the [requesting help guidelines](https://discourse.gohugo.io/t/requesting-help/9132). Feel free to tag me in your question, my forum username is [@zwbetz](https://discourse.gohugo.io/u/zwbetz/summary).
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 19302ce..8e684cf 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -14,7 +14,8 @@
{{ partial "bootstrap-js.html" . }}
{{ partial "google-analytics-async.html" . }}
+ {{ partial "mastodon-js.html" . }}
{{ partial "cookie-consent.html" . }}
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/layouts/partials/mastodon-js.html b/layouts/partials/mastodon-js.html
new file mode 100644
index 0000000..ac77131
--- /dev/null
+++ b/layouts/partials/mastodon-js.html
@@ -0,0 +1,3 @@
+{{ if ($.Page.Scratch.Get "include_mastodon") "true" }}
+<script src="https://mastodon.social/embed.js" async="async"></script>
+{{ end }}
diff --git a/layouts/shortcodes/mastodon.html b/layouts/shortcodes/mastodon.html
new file mode 100644
index 0000000..71060e0
--- /dev/null
+++ b/layouts/shortcodes/mastodon.html
@@ -0,0 +1,9 @@
+{{ .Page.Scratch.Set "include_mastodon" true }}
+{{ $width := .Get "width" | default "400" }}
+{{ $height := .Get "height" | default "333"}}
+{{ $status := .Get "status" | default "false" }}
+
+{{ if eq ($status) "false" }}
+{{ else }}
+<iframe src= "{{ $status }}/embed" class="mastodon-embed" style="max-width: 100%; border: 0" width="{{ $width }}" height="{{ $height }}"></iframe>
+{{ end }} \ No newline at end of file