Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atom.xml is not valid #1223

Closed
Leon0824 opened this issue Nov 2, 2020 · 4 comments
Closed

atom.xml is not valid #1223

Leon0824 opened this issue Nov 2, 2020 · 4 comments

Comments

@Leon0824
Copy link

Leon0824 commented Nov 2, 2020

Bug Report

Environment

Zola version: 0.12.2

Expected Behavior

Valid atom.xml from W3C Validation Service

Current Behavior

Not valid.

  1. Missing <author>, <author> should be added by whole feed or by every entry.
  2. <content> part should be
<content type="xhtml">
  <div xmlns="http://www.w3.org/1999/xhtml">
    {{ page.content }}
  </div>
</content>     

Step to reproduce

Submit a Zola atom feed to the W3C Validation Service

@Keats
Copy link
Collaborator

Keats commented Nov 2, 2020

Hmm I didn't know author was mandatory...

@kuon
Copy link

kuon commented Oct 15, 2021

This is my template that validate:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="{{ lang }}">
  <title>{{ config.title }}
  {%- if term %} - {{ term.name }}
  {%- elif section.title %} - {{ section.title }}
  {%- endif -%}
</title>
{%- if config.description %}
<subtitle>{{ config.description }}</subtitle>
{%- endif %}
<link href="{{ feed_url | safe }}" rel="self" type="application/atom+xml"/>
<link href="
  {%- if section -%}
  {{ section.permalink | escape_xml | safe }}
  {%- else -%}
  {{ config.base_url | escape_xml | safe }}
  {%- endif -%}
  "/>
<generator uri="https://www.getzola.org/">Zola</generator>
<updated>{{ last_updated | date(format="%+") }}</updated>
<id>{{ feed_url | safe }}</id>
{%- for page in pages %}
{%- if not page.extra.ignore_feed %}
<entry xml:lang="{{ page.lang }}">
  <title>{{ page.title }}</title>
  <published>{{ page.date | date(format="%+") }}</published>
  <updated>{{ page.updated | default(value=page.date) | date(format="%+") }}</updated>
  <link href="{{ page.permalink | safe }}" type="text/html"/>
  <id>{{ page.permalink | safe }}</id>
  <author>
    <name>{{ page.extra.author | default(value=config.extra.author) }}</name>
  </author>
  <content type="html">
      {{ page.content  }}
  </content>
</entry>
{%- endif %}
{%- endfor %}
</feed>

@Keats
Copy link
Collaborator

Keats commented Oct 15, 2021

Yeah the only issue is that author would be optional so it's possible that no one fills it. Would an empty value for the author still validate? It's also annoying since if we want to ensure validation, we'd likely need to promote author out of extra which sucks :/

@Keats
Copy link
Collaborator

Keats commented Jan 12, 2023

Closing as duplicate of #2024 which is less likely to be forgotten as it's more recent and has some ideas.

@Keats Keats closed this as completed Jan 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants