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

github.com/zwbetz-gh/vanilla-bootstrap-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Betz <zwbetz@gmail.com>2018-12-28 06:21:55 +0300
committerZachary Betz <zwbetz@gmail.com>2018-12-28 06:21:55 +0300
commitc39409dc7e07b9bc0e141c29a6a2a4aff181bbce (patch)
treea6b86f0d25b97234bd275f92c5e6bcf970feb26f /layouts
parent189a7d2d471bcb9a7b05a110b2cb6436d97e7843 (diff)
Bootstrap card shortcode, nasa img post
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/date-and-tags.html2
-rw-r--r--layouts/shortcodes/bootstrap-card.html26
2 files changed, 27 insertions, 1 deletions
diff --git a/layouts/partials/date-and-tags.html b/layouts/partials/date-and-tags.html
index aacdf33..7286ffb 100644
--- a/layouts/partials/date-and-tags.html
+++ b/layouts/partials/date-and-tags.html
@@ -3,6 +3,6 @@
{{ with .Params.tags }}
<br>
{{ range . }}
-<a class="btn btn-sm btn-outline-secondary tag-btn" href="{{ "/tags/" | absURL }}{{ . | urlize }}">{{ . }}</a>
+<a class="btn btn-sm btn-outline-dark tag-btn" href="{{ "/tags/" | absURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
{{ end }} \ No newline at end of file
diff --git a/layouts/shortcodes/bootstrap-card.html b/layouts/shortcodes/bootstrap-card.html
new file mode 100644
index 0000000..b8f77a8
--- /dev/null
+++ b/layouts/shortcodes/bootstrap-card.html
@@ -0,0 +1,26 @@
+{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get "img")) }}
+{{ $new := "" }}
+
+{{ if eq (.Get "command") "Fit" }}
+ {{ $new = $original.Fit (.Get "options") }}
+{{ else if eq (.Get "command") "Resize" }}
+ {{ $new = $original.Resize (.Get "options") }}
+{{ else if eq (.Get "command") "Fill" }}
+ {{ $new = $original.Fill (.Get "options") }}
+{{ else }}
+ {{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize." }}
+{{ end }}
+
+<div class="card {{ .Get "class" }}" style="{{ .Get "style" | safeCSS }}">
+ <a href="{{ $original.Permalink }}">
+ <img src="{{ $new.Permalink }}" class="card-img-top" alt="{{ .Get "alt" }}">
+ </a>
+ <div class="card-body">
+ {{ with (.Get "title") }}
+ <h5 class="card-title">{{ . | markdownify }}</h5>
+ {{ end }}
+ {{ with (.Get "text") }}
+ <p class="card-text">{{ . | markdownify }}</p>
+ {{ end }}
+ </div>
+</div> \ No newline at end of file