Browse Source

fix up atom feed to pass the w3c validator[1]..

[1] https://validator.w3.org/feed/
main
John-Mark Gurney 3 years ago
parent
commit
ce534cce32
3 changed files with 9 additions and 5 deletions
  1. +6
    -5
      layout/atom.j2
  2. +2
    -0
      layout/macros.j2
  3. +1
    -0
      site.yaml

+ 6
- 5
layout/atom.j2 View File

@@ -1,15 +1,16 @@
{% from "macros.j2" import render_excerpt, render_post with context %}
{% from "macros.j2" import fullurl with context %}
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>
{% block title %}{{ resource.meta.title|default(feed_title) }}{% endblock %}
</title>
{% block self_url %}
<link href="{{ resource.url }}" rel="self" />
<link type="application/atom+xml" href="{{ fullurl(resource.url) }}" rel="self" />
{% endblock %}

{% block site_url %}
<link href="{{ content_url('') }}"/>
<link rel="alternate" type="text/html" href="{{ fullur('/') }}"/>
{% endblock %}

{% block feed_extra %}
@@ -17,7 +18,7 @@

<updated>{{ time_now|xmldatetime }}</updated>

<id>{{ content_url(resource.url) }}/</id>
<id>{{ fullurl(resource.url) }}</id>

{% for res in resource.node.walk_resources_sorted_by_time() %}
<entry>
@@ -26,9 +27,9 @@
<link href="{{ content_url(res.url) }}"/>
<updated>{{ res.meta.created|xmldatetime }}</updated>
<published>{{ res.meta.created|xmldatetime }}</published>
<id>{{ content_url(res.url) }}</id>
<id>{{ fullurl(res.url) }}</id>
{% for tag in res.meta.tags %}
<category scheme="{{ content_url('search/label') }}"
<category scheme="{{ fullurl('search/label') }}"
term="{{tag}}"
label="{{ tag|title }}" />
{% endfor %}


+ 2
- 0
layout/macros.j2 View File

@@ -2,6 +2,8 @@
{{ res.meta.id if res.meta.id else res.slug }}{% endmacro %}
{% macro itemurl(res) %}
{{ res.url ~ "#" ~ (res.meta.id if res.meta.id else res.slug) ~ "-title" }}{% endmacro %}
{% macro fullurl(part) %}
{{ site.context.scheme_host ~ part }}{% endmacro %}

{# endmacro not on new line to prevent white space at end of macro #}



+ 1
- 0
site.yaml View File

@@ -11,6 +11,7 @@ plugins:
- hyde.ext.plugins.text.TextlinksPlugin
context:
data:
scheme_host: https://blogtest.funkthat.com
viewport: width=device-width, initial-scale=1
tweet_via: encthenet
title: encthenet ramblings


Loading…
Cancel
Save