fallback image per class
continuous-integration/drone/push Build is passing Details

This commit is contained in:
vv01f 2023-07-11 20:10:56 +02:00
parent 7897b06469
commit 77197c4977
1 changed files with 16 additions and 5 deletions

View File

@ -385,11 +385,22 @@
</xsl:if>
<a href="{link}">
<xsl:if test="content-image">
<xsl:attribute name="style">
background-image: url('<xsl:value-of select="content-image"/>');
</xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="content-image">
<xsl:attribute name="style">
background-image: url('<xsl:value-of select="content-image"/>');
</xsl:attribute>
</xsl:when>
<xsl:otherwise><!-- Fallback image -->
<xsl:choose><!-- depending on class -->
<!-- todo: random image from list (filenames might be links), maybe based on hash() -->
<xsl:when test="@class = 'news'"><xsl:attribute name="style">background-image: url('images/news/gchq-hdr.jpg');</xsl:attribute></xsl:when>
<!--
<xsl:when test="@class = 'wiki'"><xsl:attribute name="style">background-image: url('images/news/wikidata.png');</xsl:attribute></xsl:when>
-->
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="header"/>
<xsl:apply-templates select="footer"/>