Fixes urls in feed.

This commit is contained in:
Zach Leatherman 2018-01-27 23:22:40 -06:00
parent 3b9f9c111e
commit 1d36b810a3
3 changed files with 12 additions and 9 deletions

View File

@ -4,13 +4,13 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title or metadata.title }}</title>
<link rel="stylesheet" href="{{ 'css/index.css' | url }}">
<link rel="stylesheet" href="{{ 'css/prism-base16-monokai.dark.css' | url }}">
<link rel="stylesheet" href="{{ '/css/index.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 }}">
</head>
<body>
<header>
<h1 class="home"><a href="{{ '' | url }}">{{ metadata.title }}</a></h1>
<h1 class="home"><a href="{{ '/' | url }}">{{ metadata.title }}</a></h1>
<ul class="nav">
{%- 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>

View File

@ -5,8 +5,10 @@ const absoluteUrl = require("./AbsoluteUrl");
module.exports = function(htmlContent, base) {
let options = {
eachURL: function(url, attr, element) {
url = url.trim();
// #anchor in-page
if( url.trim().indexOf("#") === 0 ) {
if( url.indexOf("#") === 0 ) {
return url;
}

View File

@ -13,13 +13,14 @@ permalink: feed/feed.xml
<name>{{ metadata.author.name }}</name>
<email>{{ metadata.author.email }}</email>
</author>
{% for post in collections.posts %}
{%- for post in collections.posts %}
{% set absolutePostUrl %}{{ post.url | url | absoluteUrl(metadata.url) }}{% endset %}
<entry>
<title>{{ post.data.title }}</title>
<link href="{{ post.url | absoluteUrl(metadata.url) }}"/>
<link href="{{ absolutePostUrl }}"/>
<updated>{{ post.date | rssDate }}</updated>
<id>{{ post.url | absoluteUrl(metadata.url) }}</id>
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls(metadata.url) }}</content>
<id>{{ absolutePostUrl }}</id>
<content type="html">{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</content>
</entry>
{% endfor %}
{%- endfor %}
</feed>