diff options
author | dakkar <dakkar@thenautilus.net> | 2022-11-12 11:08:28 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2022-11-12 11:08:28 +0000 |
commit | 3287c79aa593926e8aeb2294a61cb1117aa3dcf9 (patch) | |
tree | 14a25e255ded3139b12e6d9e03babdb14236e61c | |
parent | remove twitter sidebar ticker (diff) | |
download | thenautilus-3287c79aa593926e8aeb2294a61cb1117aa3dcf9.tar.gz thenautilus-3287c79aa593926e8aeb2294a61cb1117aa3dcf9.tar.bz2 thenautilus-3287c79aa593926e8aeb2294a61cb1117aa3dcf9.zip |
add opengraph meta
-rw-r--r-- | src/HW/logscale-calc-tools/document.en.rest.txt | 2 | ||||
-rw-r--r-- | src/HW/logscale-calc-tools/document.it.rest.txt | 2 | ||||
-rw-r--r-- | src/modelli/sugihara-impossible-objects/document.en.rest.txt | 2 | ||||
-rw-r--r-- | src/modelli/sugihara-impossible-objects/document.it.rest.txt | 2 | ||||
-rw-r--r-- | src/modelli/tachikoma/document.en.rest.txt | 2 | ||||
-rw-r--r-- | src/modelli/tachikoma/document.it.rest.txt | 2 | ||||
-rw-r--r-- | templates/du2html.xsl | 63 |
7 files changed, 50 insertions, 25 deletions
diff --git a/src/HW/logscale-calc-tools/document.en.rest.txt b/src/HW/logscale-calc-tools/document.en.rest.txt index cec42f7..095508f 100644 --- a/src/HW/logscale-calc-tools/document.en.rest.txt +++ b/src/HW/logscale-calc-tools/document.en.rest.txt @@ -78,7 +78,7 @@ Linear rule: .. image:: s24d4-1.jpg :alt: 4 on C scale matching with 24 on D scale - :class: twitter + :class: preview 2) look with what, on the D scale, matches 1 on the C scale diff --git a/src/HW/logscale-calc-tools/document.it.rest.txt b/src/HW/logscale-calc-tools/document.it.rest.txt index 9c43b19..5a99b4f 100644 --- a/src/HW/logscale-calc-tools/document.it.rest.txt +++ b/src/HW/logscale-calc-tools/document.it.rest.txt @@ -80,7 +80,7 @@ Regolo lineare: .. image:: s24d4-1.jpg :alt: 4 della scala C corrispondente a 24 della scala D - :class: twitter + :class: preview 2) guardiamo a cosa, sulla scala D, corrisponde 1 della scala C diff --git a/src/modelli/sugihara-impossible-objects/document.en.rest.txt b/src/modelli/sugihara-impossible-objects/document.en.rest.txt index ba4b166..6b90338 100644 --- a/src/modelli/sugihara-impossible-objects/document.en.rest.txt +++ b/src/modelli/sugihara-impossible-objects/document.en.rest.txt @@ -32,7 +32,7 @@ four suits of playing cards: .. image:: card-suits-plus-pointy-circles-t.jpg :target: card-suits-plus-pointy-circles.jpg - :class: twitter + :class: preview and this is what they look like from the side: diff --git a/src/modelli/sugihara-impossible-objects/document.it.rest.txt b/src/modelli/sugihara-impossible-objects/document.it.rest.txt index 7aa64f1..f0ccf0a 100644 --- a/src/modelli/sugihara-impossible-objects/document.it.rest.txt +++ b/src/modelli/sugihara-impossible-objects/document.it.rest.txt @@ -33,7 +33,7 @@ e i semi delle carte: .. image:: card-suits-plus-pointy-circles-t.jpg :target: card-suits-plus-pointy-circles.jpg - :class: twitter + :class: preview di lato sono così: diff --git a/src/modelli/tachikoma/document.en.rest.txt b/src/modelli/tachikoma/document.en.rest.txt index c9bdb0a..cd7406d 100644 --- a/src/modelli/tachikoma/document.en.rest.txt +++ b/src/modelli/tachikoma/document.en.rest.txt @@ -26,7 +26,7 @@ Was it worth it? See for yourself: .. image:: front-t.jpg :alt: LEGO Tachikoma, from ahead :target: front.jpg - :class: twitter + :class: preview .. image:: back-t.jpg :alt: LEGO Tachikoma, from behind diff --git a/src/modelli/tachikoma/document.it.rest.txt b/src/modelli/tachikoma/document.it.rest.txt index bedebb8..4a772bd 100644 --- a/src/modelli/tachikoma/document.it.rest.txt +++ b/src/modelli/tachikoma/document.it.rest.txt @@ -27,7 +27,7 @@ Ne è valsa la pena? Guardate qua: .. image:: front-t.jpg :alt: Tachikoma LEGO, da davanti :target: front.jpg - :class: twitter + :class: preview .. image:: back-t.jpg :alt: Tachikoma LEGO, da dietro diff --git a/templates/du2html.xsl b/templates/du2html.xsl index 6f77e4c..fccee23 100644 --- a/templates/du2html.xsl +++ b/templates/du2html.xsl @@ -17,6 +17,14 @@ <x:param name="path"/> <x:param name="filename"/> + <x:variable name="locale"> + <x:choose> + <x:when test="$language = 'it'">it_IT</x:when> + <x:when test="$language = 'en'">en_GB</x:when> + <x:otherwise><!-- uh? --><x:value-of select="$language"/></x:otherwise> + </x:choose> + </x:variable> + <x:variable name="langs-rtf"> <x:choose> <x:when test="$language = 'it'"> @@ -160,15 +168,37 @@ <link rel="alternate" type="application/atom+xml" href="{$url}feed.{$language}.xml"/> </x:template> - <x:template match="image[contains(concat(' ',normalize-space(string(@classes)),' '),' twitter ')]" mode="twitter-card"> + <x:template match="image[contains(concat(' ',normalize-space(string(@classes)),' '),' preview ')]" mode="og-meta"> <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="https://www.thenautilus.net{substring($uri-with-slash,1,string-length($uri-with-slash) - 1)}" /> + <x:variable name="uri" select="substring($uri-with-slash,1,string-length($uri-with-slash) - 1)" /> + <meta name="twitter:image" content="https://www.thenautilus.net{$uri}" /> <x:if test="@alt"> <meta name="twitter:image:alt" content="{@alt}" /> </x:if> + <meta name="og:image" content="https://www.thenautilus.net{$uri}" /> + <x:if test="@alt"> + <meta name="og:image:alt" content="{@alt}" /> + </x:if> + </x:template> + <x:template match="image" mode="og-meta" priority="-1" /> + + <x:template match="/document" mode="og-description"> + <x:choose> + <x:when test="subtitle"> + <x:value-of select="normalize-space(subtitle)" /> + </x:when> + <x:otherwise> + <x:variable name="content"> + <x:apply-templates/> + </x:variable> + <x:value-of select="substring(normalize-space($content),0,200)"/> + <x:if test="string-length(normalize-space($content)) > 200"> + <x:text>…</x:text> + </x:if> + </x:otherwise> + </x:choose> </x:template> - <x:template match="image" mode="twitter-card" priority="-1" /> <x:template match="video"> <video controls="true" playsinline="true"> @@ -193,7 +223,7 @@ <x:template match="/document"> <html xml:lang="{$language}" lang="{$language}"> - <head> + <head prefix="og: https://ogp.me/ns#"> <title><x:value-of select="normalize-space(title)"/></title> <x:apply-templates select="." mode="stylesheet" /> <link rel="icon" type="image/png" href="/favicon.png" /> @@ -205,25 +235,20 @@ <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="og:site_name" content="the Nautilus" /> + <meta name="og:title" content="{normalize-space(title)}" /> + <x:apply-templates select="//image" mode="og-meta" /> <meta name="twitter:description"> <x:attribute name="content"> - <x:choose> - <x:when test="subtitle"> - <x:value-of select="normalize-space(subtitle)" /> - </x:when> - <x:otherwise> - <x:variable name="content"> - <x:apply-templates/> - </x:variable> - <x:value-of select="substring(normalize-space($content),0,200)"/> - <x:if test="string-length(normalize-space($content)) > 200"> - <x:text>…</x:text> - </x:if> - </x:otherwise> - </x:choose> + <x:apply-templates mode="og-description" /> + </x:attribute> + </meta> + <meta name="og:description"> + <x:attribute name="content"> + <x:apply-templates mode="og-description" /> </x:attribute> </meta> + <meta name="og:locale" content="{$locale}" /> </head> <body> <div id="wrapper"> |