mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 01:35:56 +01:00
RSS feed items with no title
Removes the title for items that have none & fixes the XSL to make more sense for those items.
This commit is contained in:
parent
e9d7dbfbdc
commit
6198c735aa
2 changed files with 50 additions and 18 deletions
|
@ -25,10 +25,10 @@
|
||||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" (.Permalink | absURL) .MediaType | safeHTML }}
|
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" (.Permalink | absURL) .MediaType | safeHTML }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{ printf "<atom:link href=%q rel=\"search\" type=\"application/opensearchdescription+xml\" />" ("/opensearch.xml" | absURL) | safeHTML }}
|
{{ printf "<atom:link href=%q rel=\"search\" type=\"application/opensearchdescription+xml\" />" ("/opensearch.xml" | absURL) | safeHTML }}
|
||||||
{{- range $i, $page := (first 42 $pages) -}}
|
{{- range $i, $page := $pages -}}
|
||||||
{{- if $page.Params.inReplyTo -}}{{ continue }}{{- end -}}
|
{{- if $page.Params.inReplyTo -}}{{ continue }}{{- end -}}
|
||||||
<item>
|
<item>{{ with .Title }}
|
||||||
<title>{{ .Title | default (delimit (slice "An untitled" (.Date.Format "January") (.Type | singularize)) " ") }}</title>
|
<title>{{ . }}</title>{{ else }}<title></title>{{ end }}
|
||||||
<link>{{ .Permalink | absURL }}</link>
|
<link>{{ .Permalink | absURL }}</link>
|
||||||
{{ if .Page.Params.Audio }}<enclosure url="{{ .Permalink | absURL }}{{ .Page.Params.Audio }}" length="{{ (os.Stat (path.Join .File.Dir .Page.Params.Audio)).Size }}" type="audio/mpeg" />{{end}}
|
{{ if .Page.Params.Audio }}<enclosure url="{{ .Permalink | absURL }}{{ .Page.Params.Audio }}" length="{{ (os.Stat (path.Join .File.Dir .Page.Params.Audio)).Size }}" type="audio/mpeg" />{{end}}
|
||||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
||||||
|
|
|
@ -34,6 +34,9 @@
|
||||||
.item {
|
.item {
|
||||||
max-width: 768px;
|
max-width: 768px;
|
||||||
}
|
}
|
||||||
|
p {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
a {
|
a {
|
||||||
color: #4166f5;
|
color: #4166f5;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
@ -44,6 +47,19 @@
|
||||||
a:hover {
|
a:hover {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
a:has(time) {
|
||||||
|
display: block;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
article:not(:first-of-type):not(:has(hgroup)) p::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
top: -1.4em;
|
||||||
|
left: calc(50% - 1.5em);
|
||||||
|
width: 3em;
|
||||||
|
border-top: 1px solid rgba(128,128,128,0.5);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -68,6 +84,7 @@
|
||||||
<h2>Recent Posts</h2>
|
<h2>Recent Posts</h2>
|
||||||
<xsl:for-each select="/rss/channel/item">
|
<xsl:for-each select="/rss/channel/item">
|
||||||
<article>
|
<article>
|
||||||
|
<xsl:if test="title != ''">
|
||||||
<hgroup>
|
<hgroup>
|
||||||
<h3>
|
<h3>
|
||||||
<a hreflang="en" target="_blank">
|
<a hreflang="en" target="_blank">
|
||||||
|
@ -84,7 +101,22 @@
|
||||||
<xsl:value-of select="substring(pubDate, 0, 17)" />
|
<xsl:value-of select="substring(pubDate, 0, 17)" />
|
||||||
</time>
|
</time>
|
||||||
</hgroup>
|
</hgroup>
|
||||||
|
</xsl:if>
|
||||||
<p><xsl:value-of select="description"/></p>
|
<p><xsl:value-of select="description"/></p>
|
||||||
|
<xsl:if test="title = ''">
|
||||||
|
<a hreflang="en" target="_blank">
|
||||||
|
<xsl:attribute name="href">
|
||||||
|
<xsl:value-of select="link"/>
|
||||||
|
</xsl:attribute>
|
||||||
|
|
||||||
|
<time>
|
||||||
|
<xsl:attribute name="datetime">
|
||||||
|
<xsl:value-of select="pubDate" />
|
||||||
|
</xsl:attribute>
|
||||||
|
<xsl:value-of select="substring(pubDate, 0, 17)" />
|
||||||
|
</time>
|
||||||
|
</a>
|
||||||
|
</xsl:if>
|
||||||
</article>
|
</article>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
</main>
|
</main>
|
||||||
|
|
Loading…
Reference in a new issue