Browse Source

feat(shortcodes): allow anonymous blockquotes

Josh Habdas 1 year ago
parent
commit
3ad1f0434c
Signed by: Josh Habdas <jhabdas@protonmail.com> GPG Key ID: B148B31154C75A74

+ 1
- 1
assets/css/theme.css View File

@@ -49,7 +49,7 @@ blockquote cite {
49 49
   display: block;
50 50
 }
51 51
 blockquote cite::before {
52
-   content: "\2014";
52
+   content: "\2014\00A0";
53 53
 }
54 54
 :target {
55 55
   color: #fff;

+ 1
- 1
layouts/partials/menu.html View File

@@ -1,3 +1,3 @@
1 1
 {{ if ne .Site.Params.show_menu false }}
2
-  {{ partial "facets/navmenu.html" (dict "name" "main" "menus" .Site.Menus "page" .)}}
2
+  {{ partial "shortcode/navmenu.html" (dict "name" "main" "menus" .Site.Menus "page" .)}}
3 3
 {{ end }}

+ 1
- 1
layouts/partials/powered-by.html View File

@@ -1,6 +1,6 @@
1 1
 {{ if ne .Site.Params.powered_by false }}
2 2
   <p class="muted">
3 3
     This page was generated using
4
-    {{ partial "facets/external.html" (dict "itemtype" "significantLink" "body" "After Dark" "href" "https://after-dark.habd.as" "referrerpolicy" "origin-when-cross-origin") }}.
4
+    {{ partial "shortcode/external.html" (dict "itemtype" "significantLink" "body" "After Dark" "href" "https://after-dark.habd.as" "referrerpolicy" "origin-when-cross-origin") }}.
5 5
   </p>
6 6
 {{ end }}

layouts/partials/facets/external.html → layouts/partials/shortcode/external.html View File


+ 14
- 7
layouts/shortcodes/blockquote.html View File

@@ -1,16 +1,23 @@
1 1
 <!--{{/*
2
-Create block and pull quotations with citations and citation links.
2
+Create pull quotes with citations and optional citation links.
3 3
 
4 4
 Basic usage:
5 5
 {{< blockquote cite="https://bitly.is/2mkxskj" citelink="https://bitly.is/2mkxskj" >}}
6
-  <p>When you create your own Branded Short Domain, you can expect to see up to a 34% increase in CTR when compared to standard bit.ly links.</p>
6
+  When you create your own Branded Short Domain, you can expect to see up to a 34% increase in CTR when compared to standard bit.ly links.
7 7
 {{< /blockquote >}}
8 8
 */}}-->
9
-<blockquote {{ with .Get "class" }}class="{{ . }}"{{ end }} {{ with .Get "citelink" }}cite="{{ . }}"{{ end }}>
10
-  {{ .Inner }}
11
-  {{ with .Get "citelink" }}
12
-    <cite><a target="_blank" href="{{ . }}">{{ $.Get "cite" }}</a></cite>
9
+
10
+{{ $body := .Get "text" | default .Inner }}
11
+{{ $class := .Get "class" }}
12
+{{ $citelink := .Get "citelink" }}
13
+{{ $cite := .Get "cite" }}
14
+<blockquote{{ with $class }} class="{{ . }}"{{ end }}{{ with $citelink }} cite="{{ . }}"{{ end }}>
15
+  <p>{{- $body | plainify -}}</p>
16
+  {{ if $citelink }}
17
+    <cite>{{ partial "shortcode/external.html" (dict "href" $citelink "body" $cite) }}</cite>
18
+  {{ else if $cite }}
19
+    <cite>{{ $cite }}</cite>
13 20
   {{ else }}
14
-    <cite>{{ .Get "cite" }}</cite>
21
+    <cite>N.N.</cite>
15 22
   {{ end }}
16 23
 </blockquote>

+ 2
- 2
layouts/shortcodes/external.html View File

@@ -42,9 +42,9 @@ Combined with button shortcode opening in same window with search query:
42 42
 {{ $rel := .Get "rel" }}
43 43
 {{ $itemtype := .Get "itemtype" }}
44 44
 {{ if .IsNamedParams }}
45
-  {{ partial "facets/external.html" (dict "href" $href "body" $body "class" $class "referrerpolicy" $referrerpolicy "target" $target "type" $type "title" $title "rel" $rel "itemtype" $itemtype "suppress_external" (and .Inner (eq (len (findRE "external" $rel)) 0))) -}}
45
+  {{ partial "shortcode/external.html" (dict "href" $href "body" $body "class" $class "referrerpolicy" $referrerpolicy "target" $target "type" $type "title" $title "rel" $rel "itemtype" $itemtype "suppress_external" (and .Inner (eq (len (findRE "external" $rel)) 0))) -}}
46 46
 {{ else }}
47
-  {{ partial "facets/external.html" (dict "href" (.Get 0)) -}}
47
+  {{ partial "shortcode/external.html" (dict "href" (.Get 0)) -}}
48 48
 {{ end -}}
49 49
 {{- if or (and .IsNamedParams (eq $href nil)) (and (eq .IsNamedParams false) (eq (.Get 0) nil)) }}
50 50
   <p>{{ partial "components/alert.html" (dict "type" "error" "body" (errorf "Invalid use of external shortcode. Please provide an external link.")) }}</p>

Loading…
Cancel
Save