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

github.com/humrochagf/colordrop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHumberto Rocha <humrochagf@gmail.com>2022-05-28 01:30:12 +0300
committerGitHub <noreply@github.com>2022-05-28 01:30:12 +0300
commit488f4142d11f3e6cd650bae67d72f4b8d9a03a53 (patch)
tree994e363ccd8cff38beda862dd2e97319ddf12d90
parentb5a70f299f7da8b08b2012765e89527afa9d5d8d (diff)
parent0e1bc0b847d1570c205dabc08598cd199616790c (diff)
Merge pull request #9 from OiYouYeahYou/list-image-hanlding
Handle missing blog images and add attribution
-rw-r--r--assets/sass/_global.scss10
-rw-r--r--layouts/_default/taxonomy.html22
-rw-r--r--layouts/blog/list.html22
3 files changed, 51 insertions, 3 deletions
diff --git a/assets/sass/_global.scss b/assets/sass/_global.scss
index ee7e471..3f78120 100644
--- a/assets/sass/_global.scss
+++ b/assets/sass/_global.scss
@@ -38,7 +38,15 @@ main {
}
article .list-image {
- width: 100%;
+ img {
+ width: 100%;
+ }
+
+ .attribution {
+ font-size: smaller;
+ text-align: center;
+ }
+
margin: 0 0 20px;
}
diff --git a/layouts/_default/taxonomy.html b/layouts/_default/taxonomy.html
index 3f8f808..a90182e 100644
--- a/layouts/_default/taxonomy.html
+++ b/layouts/_default/taxonomy.html
@@ -13,7 +13,27 @@
{{ partial "publish" . }}
- <img class="list-image" src="{{ index .Params.images 0 | safeURL }}" alt="{{ .Title }}" title="{{ .Title }}" />
+ {{ if and
+ (ne nil .Params.images)
+ (ne nil (index .Params.images 0))
+ }}
+ <div class="list-image">
+ {{ $image := index .Params.images 0 }}
+ <a href="{{ .Permalink }}">
+ <img
+ src="{{ $image.src | safeURL }}"
+ alt="{{ .Title }}"
+ title="{{ .Title }}"
+ />
+ </a>
+
+ {{ if ne nil $image.attribution }}
+ <div class="attribution">
+ {{ print $image.attribution | safeHTML }}
+ </div>
+ {{ end }}
+ </div>
+ {{ end }}
{{ .Summary }}
</article>
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index 30f32ee..f253233 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -13,7 +13,27 @@
{{ partial "publish" . }}
- <img class="list-image" src="{{ index .Params.images 0 | safeURL }}" alt="{{ .Title }}" title="{{ .Title }}" />
+ {{ if and
+ (ne nil .Params.images)
+ (ne nil (index .Params.images 0))
+ }}
+ <div class="list-image">
+ {{ $image := index .Params.images 0 }}
+ <a href="{{ .Permalink }}">
+ <img
+ src="{{ $image.src | safeURL }}"
+ alt="{{ .Title }}"
+ title="{{ .Title }}"
+ />
+ </a>
+
+ {{ if ne nil $image.attribution }}
+ <div class="attribution">
+ {{ print $image.attribution | safeHTML }}
+ </div>
+ {{ end }}
+ </div>
+ {{ end }}
{{ .Summary }}
</article>