Fixes urls in feed.
This commit is contained in:
parent
3b9f9c111e
commit
1d36b810a3
@ -4,13 +4,13 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>{{ title or metadata.title }}</title>
|
<title>{{ title or metadata.title }}</title>
|
||||||
<link rel="stylesheet" href="{{ 'css/index.css' | url }}">
|
<link rel="stylesheet" href="{{ '/css/index.css' | url }}">
|
||||||
<link rel="stylesheet" href="{{ 'css/prism-base16-monokai.dark.css' | url }}">
|
<link rel="stylesheet" href="{{ '/css/prism-base16-monokai.dark.css' | url }}">
|
||||||
<link rel="alternate" href="{{ metadata.feed.path | url }}" type="application/atom+xml" title="{{ metadata.title }}">
|
<link rel="alternate" href="{{ metadata.feed.path | url }}" type="application/atom+xml" title="{{ metadata.title }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1 class="home"><a href="{{ '' | url }}">{{ metadata.title }}</a></h1>
|
<h1 class="home"><a href="{{ '/' | url }}">{{ metadata.title }}</a></h1>
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
{%- for nav in collections.nav | reverse -%}
|
{%- for nav in collections.nav | reverse -%}
|
||||||
<li class="nav-item{% if nav.url == page.url %} nav-item-active{% endif %}"><a href="{{ nav.url | url }}">{{ nav.data.navtitle }}</a></li>
|
<li class="nav-item{% if nav.url == page.url %} nav-item-active{% endif %}"><a href="{{ nav.url | url }}">{{ nav.data.navtitle }}</a></li>
|
||||||
|
@ -5,8 +5,10 @@ const absoluteUrl = require("./AbsoluteUrl");
|
|||||||
module.exports = function(htmlContent, base) {
|
module.exports = function(htmlContent, base) {
|
||||||
let options = {
|
let options = {
|
||||||
eachURL: function(url, attr, element) {
|
eachURL: function(url, attr, element) {
|
||||||
|
url = url.trim();
|
||||||
|
|
||||||
// #anchor in-page
|
// #anchor in-page
|
||||||
if( url.trim().indexOf("#") === 0 ) {
|
if( url.indexOf("#") === 0 ) {
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,13 +13,14 @@ permalink: feed/feed.xml
|
|||||||
<name>{{ metadata.author.name }}</name>
|
<name>{{ metadata.author.name }}</name>
|
||||||
<email>{{ metadata.author.email }}</email>
|
<email>{{ metadata.author.email }}</email>
|
||||||
</author>
|
</author>
|
||||||
{% for post in collections.posts %}
|
{%- for post in collections.posts %}
|
||||||
|
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
|
||||||
<entry>
|
<entry>
|
||||||
<title>{{ post.data.title }}</title>
|
<title>{{ post.data.title }}</title>
|
||||||
<link href="{{ post.url | absoluteUrl(metadata.url) }}"/>
|
<link href="{{ absolutePostUrl }}"/>
|
||||||
<updated>{{ post.date | rssDate }}</updated>
|
<updated>{{ post.date | rssDate }}</updated>
|
||||||
<id>{{ post.url | absoluteUrl(metadata.url) }}</id>
|
<id>{{ absolutePostUrl }}</id>
|
||||||
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls(metadata.url) }}</content>
|
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
|
||||||
</entry>
|
</entry>
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
</feed>
|
</feed>
|
Loading…
Reference in New Issue
Block a user