chore: add images to feed entries if available

This commit is contained in:
Cory Dransfeldt 2024-08-12 08:49:01 -07:00
parent e33a961ba3
commit e8a03dbc7c
No known key found for this signature in database
5 changed files with 59 additions and 30 deletions

View file

@ -75,6 +75,9 @@
--font-weight-base: 400;
--font-weight-bold: 600;
--font-weight-extrabold: 800;
/* borders */
--border-default: 1px solid var(--accent-color);
}
@media (prefers-color-scheme: dark) {
@ -134,6 +137,14 @@
margin-right: auto;
}
main footer {
margin-bottom: var(--sizing-base);
}
main footer hr {
margin-top: 0;
}
.default-wrapper {
padding-top: var(--sizing-2xl);
}
@ -214,8 +225,12 @@
border-bottom: 0;
}
.description {
margin-bottom: var(--sizing-base);
.item img {
border: var(--border-default);
width: 100%;
height: auto;
display: block;
margin-top: var(--sizing-base);
}
p {
@ -329,10 +344,17 @@
</a>
</h3>
<xsl:value-of select="description" disable-output-escaping="yes"/>
<xsl:if test="enclosure">
<img src="{enclosure/@url}" alt="{title}" />
</xsl:if>
</div>
</xsl:for-each>
</section>
</div>
<footer>
<hr />
<p>Subscribe by adding <code><xsl:value-of select="rss/channel/atom:link/@href"/></code> to your feed reader of choice.</p>
</footer>
</main>
</div>
</body>

View file

@ -27,6 +27,9 @@
<link>{{ entry.url | encodeAmp }}</link>
<pubDate>{{ entry.date | stringToRFC822Date }}</pubDate>
<guid isPermaLink="false">{{ entry.url | encodeAmp }}</guid>
{%- if entry.image -%}
<enclosure url="https://cdn.coryd.dev{{ entry.image }}?class=w800" type="image/jpeg" />
{%- endif -%}
<description>{{ entry.excerpt | escape }}</description>
</item>
{%- endfor %}