OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to change <rights> tag to <copyright> in Atom feed?

  • Thread starter Thread starter wycherley22
  • Start date Start date
W

wycherley22

Guest
I am using the feed module to generate an Atom feed in CAP format. Here is the code I am using to generate the feed:

Code:
const feed = new Feed({
    title: 'Event Notifications',
    generator: 'Custom CAP XML Generator',
    description: 'Notifications for events',
    id: config.url + '/notifications.atom',
    link: config.url + '/notifications.atom',
    updated: new Date(),
    author: {
      name: 'Notification Agency',
      email: '[email protected]',
      link: 'https://www.notification-agency.example.com'
    },
    copyright: 'https://www.example.com/open-license'
});

I have been asked to change the <rights> tag to <copyright> in the generated feed. However, the module automatically generates a <rights> tag, and all the documentation I found indicates that it should be <rights>. I am not sure enough about the CAP format or Atom feeds to confirm if this is correct or if I should push back on this request.

If it is indeed correct that the <rights> tag should be <copyright>, I came up with a workaround to "shoehorn" the <copyright> tag into the feed as follows:

Code:
const atomFeed = feed.atom1();

const copyrightText = '\n<copyright>Copyright (c) 2024, Notification Agency. Licensed under Creative Commons BY 4.0</copyright>';

const subtitleTag = '</subtitle>';
const subtitlePosition = atomFeed.indexOf(subtitleTag) + subtitleTag.length;
const feedWithCopyright = `${atomFeed.slice(0, subtitlePosition)}${copyrightText}${atomFeed.slice(subtitlePosition)}`;

My questions are:


  • Is it correct to use the <copyright> tag in an Atom feed for CAP format, or should it be <rights>?


  • If <copyright> is indeed the correct tag, is my workaround an acceptable solution, or is there a better way to handle this within the feed module?

<p>I am using the <a href="https://www.npmjs.com/package/feed" rel="nofollow noreferrer">feed</a> module to generate an Atom feed in CAP format. Here is the code I am using to generate the feed:</p>
<pre><code>const feed = new Feed({
title: 'Event Notifications',
generator: 'Custom CAP XML Generator',
description: 'Notifications for events',
id: config.url + '/notifications.atom',
link: config.url + '/notifications.atom',
updated: new Date(),
author: {
name: 'Notification Agency',
email: '[email protected]',
link: 'https://www.notification-agency.example.com'
},
copyright: 'https://www.example.com/open-license'
});
</code></pre>
<p>I have been asked to change the <code><rights></code> tag to <code><copyright></code> in the generated feed. However, the module automatically generates a <code><rights></code> tag, and all the documentation I found indicates that it should be <code><rights></code>. I am not sure enough about the CAP format or Atom feeds to confirm if this is correct or if I should push back on this request.</p>
<p>If it is indeed correct that the <code><rights></code> tag should be <code><copyright></code>, I came up with a workaround to "shoehorn" the <code><copyright></code> tag into the feed as follows:</p>
<pre><code>const atomFeed = feed.atom1();

const copyrightText = '\n<copyright>Copyright (c) 2024, Notification Agency. Licensed under Creative Commons BY 4.0</copyright>';

const subtitleTag = '</subtitle>';
const subtitlePosition = atomFeed.indexOf(subtitleTag) + subtitleTag.length;
const feedWithCopyright = `${atomFeed.slice(0, subtitlePosition)}${copyrightText}${atomFeed.slice(subtitlePosition)}`;
</code></pre>
<p>My questions are:</p>
<ul>
<li><p>Is it correct to use the <code><copyright></code> tag in an Atom feed for CAP format, or should it be <code><rights></code>?</p>
</li>
<li><p>If <code><copyright></code> is indeed the correct tag, is my workaround an acceptable solution, or is there a better way to handle this within the feed module?</p>
</li>
</ul>
 

Latest posts

A
Replies
0
Views
1
AgencyAnalytics
A
S
Replies
0
Views
1
Stacker Media
S
C
Replies
0
Views
1
CC.Talent
C
Top