summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2016-05-02 16:15:47 +0100
committerdakkar <dakkar@thenautilus.net>2016-05-02 16:31:01 +0100
commit5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e (patch)
tree63300eb8217e8b6edf6e187b1e57f9411df46221 /templates
parentadd kyousougiga to list (diff)
downloadthenautilus-5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e.tar.gz
thenautilus-5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e.tar.bz2
thenautilus-5a17c4c7c479bbbdbed4de3ab65feaaaa9fcf20e.zip
add images to twitter cards
won't really work, since Twitter really likes full URIs ☹
Diffstat (limited to 'templates')
-rw-r--r--templates/du2html.xsl11
1 files changed, 11 insertions, 0 deletions
diff --git a/templates/du2html.xsl b/templates/du2html.xsl
index 55fdcd7..aca58ba 100644
--- a/templates/du2html.xsl
+++ b/templates/du2html.xsl
@@ -160,6 +160,16 @@
<link rel="alternate" type="application/atom+xml" href="{$url}feed.{$language}.xml"/>
</x:template>
+ <x:template match="image[contains(concat(' ',normalize-space(@classes),' '),' twitter ')]" mode="twitter-card">
+ <x:variable name="uri-with-slash" select="wc:dst-uri-for(@uri,/document/@source)" />
+ <!-- dst-uri-for appends a / at the end :( -->
+ <meta name="twitter:image" content="{substring($uri-with-slash,1,string-length($uri-with-slash) - 1)}" />
+ <x:if test="@alt">
+ <meta name="twitter:image:alt" content="{@alt}" />
+ </x:if>
+ </x:template>
+ <x:template match="image" mode="twitter-card" priority="-1" />
+
<!-- qui ce ne freghiamo del @source, tanto viene usata solo per i
documenti stand-alone -->
@@ -177,6 +187,7 @@
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@dakkar" />
<meta name="twitter:title" content="{normalize-space(title)}" />
+ <x:apply-templates select="//image" mode="twitter-card" />
<meta name="twitter:description">
<x:attribute name="content">
<x:choose>