Skip to content

Commit

Permalink
Add images xsl
Browse files Browse the repository at this point in the history
  • Loading branch information
Septdir committed Dec 2, 2020
1 parent 4efd292 commit b7d0272
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 23 deletions.
34 changes: 27 additions & 7 deletions com_jlsitemap/layouts/site/debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,35 @@
</a>
<?php endif; ?>
</div>
<?php if ($multilanguage && is_array($include->get('alternates', false))): ?>
<div class="alternates">
<div class="additions">
<?php if ($multilanguage && is_array($include->get('alternates', false))): ?>
<?php foreach ($include->get('alternates') as $lang => $loc): ?>
<a href="<?php echo $loc; ?>" class="alternate" target="_blank">
<?php echo $lang; ?>
</a>
<div class="item">
<a href="<?php echo $loc; ?>" class="alternate" target="_blank">
<?php echo $lang; ?>
</a>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php endif; ?>
<?php if (is_array($include->get('images', false))): ?>
<?php foreach ($include->get('images') as $i => $src): ?>
<div class="item">
<a href="<?php echo $src; ?>" title="<?php echo $src; ?>" class="image"
target="_blank">
<svg width="20" height="20" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg" data-svg="image">
<rect fill="none" stroke="#1e87f0" x=".5" y="2.5" width="19"
height="15"></rect>
<polyline fill="none" stroke="#1e87f0" stroke-width="1.01"
points="4,13 8,9 13,14"></polyline>
<polyline fill="none" stroke="#1e87f0" stroke-width="1.01"
points="11,12 12.5,10.5 16,14"></polyline>
</svg>
</a>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</td>
<td><?php echo $include->get('changefreq', ''); ?></td>
<td><?php echo $include->get('priority', ''); ?></td>
Expand Down
38 changes: 31 additions & 7 deletions com_jlsitemap/layouts/xsl/urlset.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<xsl:output method="html" indent="yes" encoding="UTF-8"/>
<xsl:template match="/">
Expand Down Expand Up @@ -86,11 +87,14 @@
<xsl:value-of select="sitemap:loc"/>
</a>
</div>
<xsl:if test="xhtml:link">
<div class="alternates">
<div class="additions">
<xsl:if test="xhtml:link">
<xsl:apply-templates select="xhtml:link"/>
</div>
</xsl:if>
</xsl:if>
<xsl:if test="image:image">
<xsl:apply-templates select="image:image"/>
</xsl:if>
</div>
</td>
<td>
<xsl:value-of select="sitemap:changefreq"/>
Expand All @@ -111,10 +115,30 @@
<xsl:value-of select="@href"/>
</xsl:variable>
<xsl:if test="@hreflang">
<a href="{$altloc}" class="alternate" target="_blank">
<xsl:value-of select="@hreflang"/>
</a>
<div class="item">
<a href="{$altloc}" class="alternate" target="_blank">
<xsl:value-of select="@hreflang"/>
</a>
</div>
</xsl:if>
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="image:image">
<xsl:variable name="loc">
<xsl:value-of select="image:loc"/>
</xsl:variable>
<div class="item">
<a href="{$loc}" class="image" title="{$loc}" target="_blank">
<svg width="20" height="20" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg" data-svg="image">
<rect fill="none" stroke="#1e87f0" x=".5" y="2.5" width="19"
height="15"></rect>
<polyline fill="none" stroke="#1e87f0" stroke-width="1.01"
points="4,13 8,9 13,14"></polyline>
<polyline fill="none" stroke="#1e87f0" stroke-width="1.01"
points="11,12 12.5,10.5 16,14"></polyline>
</svg>
</a>
</div>
</xsl:template>
</xsl:stylesheet>
27 changes: 19 additions & 8 deletions com_jlsitemap/media/css/sitemap.css
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,25 @@ a:focus {
text-decoration: underline;
}

.alternates {
margin-top: 8px;
clear: both;
.additions {
display: flex;
align-items: center;
flex-wrap: wrap;
}

.alternates .alternate {
display: inline-block;
float: left;
.additions .item {
display: inline-flex;
margin: 3px 3px 3px 0;
}

.additions .item > a {
display: inline-block;
}

.additions .alternate {
line-height: 1.5;
padding: 0 10px;
background: #1e87f0;
line-height: 1.5;
font-size: 12px;
color: #fff;
vertical-align: middle;
Expand All @@ -122,7 +129,11 @@ a:focus {
text-transform: uppercase;
}

.alternates .alternate:hover {
.additions .alternate:hover {
color: #fff;
text-decoration: none;
}

.additions .image {
line-height: 0;
}
2 changes: 1 addition & 1 deletion com_jlsitemap/media/css/sitemap.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b7d0272

Please sign in to comment.