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

how to add media:content? #93

Open
ralyodio opened this issue Mar 29, 2020 · 2 comments
Open

how to add media:content? #93

ralyodio opened this issue Mar 29, 2020 · 2 comments

Comments

@ralyodio
Copy link

There doesn't seem to be a way to add media:content

<media:content url="https://thedailyshitter.com/content/images/2020/03/money-business-material-cash-bank-currency-629802-pxhere.com-2-.jpg" medium="image"/>

@deanshelton913
Copy link

rssInstance({
custom_elements: [
              {
                  'media:content': [
                      {
                          _attr: {
                              type: 'application/x-shockwave-flash',
                              medium: 'video',
                              isDefault: 'true',
                              expression: 'full',
                              duration: '117',
                              url: 'https:,//www.youtube.com/v/XnZ_J3l_0z4',
                              src: your url
                          }
                      },})

something like this should work, yeah?

@FerrariAndrea
Copy link

The same need here,

This is my solution:

  const feedOptions = {
   title: '...',
   description: "...",
   site_url: '...',
   feed_url: `...`,
   image_url: `...`,
   pubDate: new Date(),
   copyright: `...`,
   custom_namespaces: {
        media: "http://search.yahoo.com/mrss/",
    }
  };
 
  const feed = new RSS(feedOptions);

Important code part that you need to add:

custom_namespaces: {
media: "http://search.yahoo.com/mrss/",
}

Then in your item:

 feed.item({
     title: "...",
     description:  "...",
     url:  "...",
     date:  "...",
     author: "...",
     custom_elements: [
      {
        'media:content': [
            {
                _attr: {
                    medium: 'image',
                    URL:  "<YOUR IMAGE URL>"
                }
            }]
      }]
    }); 

Result in the feed:

<media:content medium="image" url="<YOUR IMAGE URL>"> </media:content>

I test with Google RSS feed reader and it is working now!

I think you should write down in your documentation a similar example, it is really useful!
Nowadays images in the feed have 80% of relevance.

(thx to #19 (comment) for the option configuration part)

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