mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 09:46:11 +01:00
Add stylesheets to my OPML feeds.
This commit is contained in:
parent
20a6d2b473
commit
dcdff6caae
5 changed files with 106 additions and 4 deletions
|
@ -184,7 +184,7 @@ date = ["date", "publishDate", "lastmod", ":git"]
|
|||
|
||||
[mediaTypes]
|
||||
[mediaTypes.'text/opml']
|
||||
suffixes = ['opml']
|
||||
suffixes = ['opml.xml']
|
||||
[mediaTypes.'text/gemini']
|
||||
suffixes = ['gmi']
|
||||
[outputFormats]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
{{- printf "<?xml-stylesheet href=\"/opml.xsl\" type=\"text/xsl\"?>" | safeHTML }}
|
||||
<opml version="2.0">
|
||||
<head>
|
||||
<title>{{ .Title }} (reading lists byJP)</title>
|
|
@ -1,7 +1,9 @@
|
|||
{{- $isReadingListRoot := eq (path.Dir (path.Dir .RelPermalink)) "/" -}}
|
||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
||||
{{- printf "<?xml-stylesheet href=\"/opml.xsl\" type=\"text/xsl\"?>" | safeHTML }}
|
||||
<opml version="2.0">
|
||||
<head>
|
||||
<title>{{ .Title }} (reading lists byJP)</title>
|
||||
<title>{{ .Title }}{{- if not $isReadingListRoot }} (reading lists byJP){{ end }}</title>
|
||||
<dateModified>{{ .Lastmod.Format "02 Jan 2006 15:04 MST" }}</dateModified>
|
||||
<ownerId>https://www.byjp.me</ownerId>
|
||||
</head>
|
||||
|
@ -12,7 +14,7 @@
|
|||
{{ end -}}
|
||||
|
||||
{{- if gt (len .Pages) 0 }}
|
||||
<outline {{ if .Date }}created="{{ .Date.Format "02 Jan 2006 15:04 MST" }}" {{ end }}title="{{ .Title }}" text="{{ .Title }}">
|
||||
<outline {{ if .Date }}created="{{ .Date.Format "02 Jan 2006 15:04 MST" }}" {{ end }}title="{{ .Title }}" text="{{ .Title }}" type="html" htmlUrl="{{ .Permalink }}" description="{{ .Summary }}">
|
||||
{{ range .Pages -}}
|
||||
{{ if .Params.feed -}}
|
||||
<outline {{ if .Date }}created="{{ .Date.Format "02 Jan 2006 15:04 MST" }}" {{ end }}title="{{ .Title }}" text="{{ .Title }}" type="rss" xmlUrl="{{ .Params.feed.rss }}" htmlUrl="{{ .Params.feed.url }}" description="{{ .Summary }}"/>
|
99
static/opml.xsl
Normal file
99
static/opml.xsl
Normal file
|
@ -0,0 +1,99 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">
|
||||
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
|
||||
<xsl:template match="/">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr">
|
||||
<head>
|
||||
<title><xsl:value-of select="/opml/head/title"/></title>
|
||||
<meta charset="UTF-8" />
|
||||
<meta http-equiv="x-ua-compatible" content="IE=edge,chrome=1" />
|
||||
<meta http-equiv="content-language" content="en_US" />
|
||||
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1,shrink-to-fit=no" />
|
||||
<meta name="referrer" content="none" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
color: #222;
|
||||
font-family: "Segoe UI", apple-system, BlinkMacSystemFont, Futura, Roboto, Arial, system-ui, sans-serif;
|
||||
}
|
||||
.container {
|
||||
align-item: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
h3 {
|
||||
margin-block-end: 0.2em;
|
||||
}
|
||||
hgroup {
|
||||
margin-block-end: 1em;
|
||||
}
|
||||
time {
|
||||
display: block;
|
||||
font-style: italic;
|
||||
font-size: small;
|
||||
}
|
||||
.item {
|
||||
max-width: 768px;
|
||||
}
|
||||
a {
|
||||
color: #4166f5;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:visited {
|
||||
color: #3f00ff;
|
||||
}
|
||||
a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="item">
|
||||
<header>
|
||||
<hgroup>
|
||||
<h1><xsl:value-of select="/opml/head/title"/></h1>
|
||||
<p>A collection of feeds from elsewhere on the internet that you may enjoy. Many feed readers will accept OPML feeds (like this one) as sources, allowing you to subscribe to the feeds below <em>and</em> any I add in the future.</p>
|
||||
</hgroup>
|
||||
<a hreflang="en" target="_blank">
|
||||
<xsl:attribute name="href">./</xsl:attribute>
|
||||
Visit this page on my site for more information →
|
||||
</a>
|
||||
</header>
|
||||
<main>
|
||||
<xsl:for-each select="/opml/body/outline">
|
||||
<section>
|
||||
<hgroup>
|
||||
<h2>
|
||||
<a hreflang="en" target="_blank">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="@htmlUrl"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@title"/>
|
||||
</a>
|
||||
</h2>
|
||||
</hgroup>
|
||||
<p>
|
||||
<xsl:value-of select="@description"/>
|
||||
</p>
|
||||
|
||||
<ul>
|
||||
<xsl:for-each select="outline">
|
||||
<li>
|
||||
<a hreflang="en" target="_blank">
|
||||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="@htmlUrl"/>
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="@title"/>
|
||||
</a> — <xsl:value-of select="@description"/>
|
||||
</li>
|
||||
</xsl:for-each>
|
||||
</ul>
|
||||
</section>
|
||||
</xsl:for-each>
|
||||
</main>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
|
@ -61,7 +61,7 @@
|
|||
<xsl:attribute name="href">
|
||||
<xsl:value-of select="/rss/channel/link"/>
|
||||
</xsl:attribute>
|
||||
Visit Website →
|
||||
Visit this page on my site →
|
||||
</a>
|
||||
</header>
|
||||
<main>
|
||||
|
|
Loading…
Reference in a new issue