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

github.com/asurbernardo/amperage.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAsur <asur@asurbernardo.com>2019-12-18 17:38:26 +0300
committerAsur <asur@asurbernardo.com>2019-12-18 17:38:26 +0300
commit881444dcbe8f37b3deeb4d3fe08524688930e861 (patch)
treeff54c95a3a5b0d736af7bdcf28e3ff1a5208e67c
parentb38f9a9ea707a0ae8dabac800ef66df140246872 (diff)
Add captions to amp images
-rw-r--r--assets/theme.scss22
-rw-r--r--layouts/partials/shortcodes/amp-image.html11
2 files changed, 29 insertions, 4 deletions
diff --git a/assets/theme.scss b/assets/theme.scss
index ca9587b..5204636 100644
--- a/assets/theme.scss
+++ b/assets/theme.scss
@@ -126,6 +126,21 @@ blockquote {
}
}
+.figure {
+ position: relative;
+ &__caption {
+ display: block;
+ position: absolute;
+ max-width: 60%;
+ bottom: 1rem;
+ left: -1rem;
+ padding: 0 1rem;
+ background-color: #333;
+ color: white;
+ font-weight: 700;
+ }
+}
+
#tags {
margin: 0;
padding: 0;
@@ -254,4 +269,11 @@ blockquote {
margin-top: 1.5em;
justify-content: space-between;
}
+ .figure {
+ position: relative;
+ &__caption {
+ position: relative;
+ max-width: 100%;
+ }
+ }
} \ No newline at end of file
diff --git a/layouts/partials/shortcodes/amp-image.html b/layouts/partials/shortcodes/amp-image.html
index cdb7f1f..58bb336 100644
--- a/layouts/partials/shortcodes/amp-image.html
+++ b/layouts/partials/shortcodes/amp-image.html
@@ -1,5 +1,6 @@
-<amp-img
- {{ with .class }}class="{{ . }}"{{ end }}
+<figure class="figure">
+ <amp-img
+ class="figure__image {{ with .class }}{{ . }}{{ end }}"
{{ with .alt }}alt="{{ range (split . " ") }}{{ . }} {{ end }}"{{ end }}
{{ with .attribution }}attribution="{{ range (split . " ") }}{{ . }} {{ end }}"{{ end }}
{{ with .srcset }}srcset="{{ range (split . " ") }}{{ . | absURL }} {{ end }}"{{ end }}
@@ -9,5 +10,7 @@
{{ with .width }}width="{{ . }}"{{ end }}
{{ with .height }}height="{{ . }}"{{ end }}
{{ with .layout }}layout="{{ . }}"{{ end }}
- {{ with .src }}src="{{ . | absURL}}"{{ end }}>
-</amp-img> \ No newline at end of file
+ {{ with .media }}media="{{ . }}"{{ end }}
+ {{ with .src }}src="{{ . | absURL}}"{{ end }}></amp-img>
+ {{ with .caption }}<figcaption class="figure__caption">{{ . }}</figcaption>{{ end }}
+</figure> \ No newline at end of file