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

Missing rel=self link? #39

Closed
dgmstuart opened this issue Apr 8, 2022 · 2 comments
Closed

Missing rel=self link? #39

dgmstuart opened this issue Apr 8, 2022 · 2 comments

Comments

@dgmstuart
Copy link

When I validate an atom feed produced by this gem I get a warning:

Missing atom:link with rel="self"

https://validator.w3.org/feed/docs/warning/MissingSelf.html

I don't know if this is something which I can add using the gem's DSL or would it require a change in the source code?

Source:

    RSS::Maker.make('atom') do |maker|
      maker.channel.author = 'Swing Out London'
      maker.channel.updated = Audit.maximum(:created_at).iso8601
      maker.channel.id = 'https://www.swingoutlondon.com/'
      maker.channel.link = 'https://www.swingoutlondon.com/audit_log.atom'
      maker.channel.title = 'Swing Out London Audit Log'
      maker.channel.description = 'Audit Log for Swing Out London'

      audits.each do |audit|
        editor = Editor.build(audit)
        maker.items.new_item do |item|
          item.link = audit_show_link(audit.auditable_type, audit.auditable_id)
          item.title = audit_title(audit)
          item.updated = audit.created_at.iso8601
          item.author = editor.name
          item.description = JSON.pretty_generate(audit.as_json)
        end
      end
    end

Atom:

<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"
  xmlns:dc="http://purl.org/dc/elements/1.1/">
  <author>
    <name>Swing Out London</name>
  </author>
  <id>https://www.swingoutlondon.com/</id>
  <link href="https://www.swingoutlondon.com/audit_log.atom"/>
  <subtitle>Audit Log for Swing Out London</subtitle>
  <title>Swing Out London Audit Log</title>
  <updated>2022-04-07T20:59:47Z</updated>
  <entry>
   <!-- ... -->
@kou
Copy link
Member

kou commented Apr 9, 2022

Use the following code:

      link = maker.channel.links.new_link
      link.href = 'https://www.swingoutlondon.com/audit_log.atom'
      link.rel = 'self'

@dgmstuart
Copy link
Author

Ah that makes sense - thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants