Update image

This commit is contained in:
Andros Fenollosa 2021-07-03 01:20:35 +02:00
parent e34e09eccd
commit 43439c4ed9
2 changed files with 15 additions and 2 deletions

View File

@ -193,6 +193,18 @@
margin: 0;
}
.article__header-img > img {
height: 12rem;
}
.feed__article:nth-child(1) .article__header-img > img,
.feed__article:nth-child(2) .article__header-img > img,
.feed__article:nth-child(3) .article__header-img > img,
.feed__article:nth-child(4) .article__header-img > img
{
height: initial;
}
.feed__article:nth-child(2) .article__titles,
.feed__article:nth-child(3) .article__titles,
.feed__article:nth-child(4) .article__titles,
@ -243,7 +255,7 @@
<header class="article__header">
{% if article.cover %}
<p class="article__header-img">
<img src="{{ article.cover }}" alt="{{ article.title }}">
<img loading="lazy" src="{{ article.cover }}" alt="{{ article.title }}">
</p>
{% endif %}
<div class="article__titles">

View File

@ -32,7 +32,8 @@
;; Add cover to article search first image in description
;; Iterate every blog
(map (fn [article]
(assoc article :cover (second (re-find #"<img[^>]+src=\"([^\">]+)\"" (str (get-in article [:description :value])))))
(let [url-article (second (re-find #"<img[^>]+src=\"([^\">]+)\"" (str (get-in article [:description :value]))))]
(assoc article :cover (if (nil? url-article) (get-in article [:feed :image :url]) url-article)))
) articles))