How to use feed - 10 common examples

To help you get started, we’ve selected a few feed examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phenomic / phenomic / src / loader-feed-webpack-plugin / __tests__ / index.js View on Github external
)
      .toBeFalsy()
      if (stats.hasErrors()) {
        console.error(stats.compilation.errors)
      }

      // doesn't give any warning
      expect(
        stats.hasWarnings()
      )
      .toBeFalsy()
      if (stats.hasWarnings()) {
        console.log(stats.compilation.warnings)
      }

      const feed = stats.compilation.assets["feed.xml"]
      if (!feed) {
        console.log(stats.compilation.assets)
      }

      // should create a xml for the feed
      expect(
        feed && feed._value,
      )
      .toBeTruthy()

      // should contain a filtred entry (link)
      expect(
        feed._value.includes("/fixtures/two"),
      )
      .toBeTruthy()
github copenhagenjs / copenhagenjs.dk / runs / feed / server.js View on Github external
import http from 'http'
import { Feed } from 'feed'
import data from './_posts/_data.json'
import { readFileSync } from 'fs'
import fm from 'front-matter'
import marked from 'marked'

const feed = new Feed({
  title: 'CopenhagenJS',
  description: 'A monthly meetup about JavaScript in Copenhagen',
  id: 'https://copenhagenjs.dk/',
  link: 'https://copenhagenjs.dk/',
  language: 'en', // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
  image: 'https://copenhagenjs.dk/static/images/cphjs.png',
  favicon: 'https://copenhagenjs.dk/static/images/cphjs.png',
  generator: '' // optional, default = 'Feed for Node.js'
})

data.posts.forEach(post => {
  const markdown = readFileSync('./_posts/' + post, 'utf8')
  const parsed = fm(markdown)
  const date = parsed.attributes.date
    ? new Date(parsed.attributes.date + ' GMT+0200')
    : new Date(
github frontarm / navi / examples / blog / src / renderRSSFeedToString.js View on Github external
async function renderRSSFeed({ routes }) {
  let publicURL = process.env.PUBLIC_URL || '/'
  let { paths } = await crawl({
    routes,
    root: '/posts',
  })

  const feed = new Feed({
    title: siteMetadata.title,
    description: siteMetadata.description,
    id: publicURL,
    // TODO: set this based on the siteMap slugs
    // updated: new Date(),
    link: publicURL,
    author: {
      name: siteMetadata.author,
    },
  });

  for (let pathname of paths.sort()) {
    let route = await resolve({
      routes,
      url: pathname,
    })
github cofacts / rumors-site / pages / api / articles / [feed].js View on Github external
res.status(400).json(errors);
  }

  const queryString = querystring.stringify(query, '&'); // Use & for XML meta tags
  const feedOption = {
    title: (query.q ? `${query.q} | ` : '') + t`Cofacts reported messages`,
    link: `${PUBLIC_URL}/articles?${queryString}`,
    description: t`List of messages reported by Cofacts users`,
    feedLinks: {
      json: `${PUBLIC_URL}/api/articles/json1?${queryString}`,
      rss: `${PUBLIC_URL}/api/articles/rss2?${queryString}`,
      atom: `${PUBLIC_URL}/api/articles/atom1?${queryString}`,
    },
  };

  const feedInstance = new Feed(feedOption);

  data.ListArticles.edges.forEach(({ node }) => {
    const text = getArticleText(node);
    const url = `${PUBLIC_URL}/article/${node.id}`;
    feedInstance.addItem({
      id: url,
      title: ellipsis(text, { wordCount: TITLE_LENGTH }),

      // https://stackoverflow.com/a/54905457/1582110
      description: text,

      link: url,
      date: new Date(node.createdAt),
      image: getImage(node),
    });
  });
github mwichary / twitter-thread-list / generate-thread-list.js View on Github external
'thread_score': tweet.thread_score,
    'thread_length': tweet.thread_length,
    'retweet_count_combined': tweet.retweet_count_combined,
    'favorite_count_combined': tweet.favorite_count_combined,
  } 

  filteredOutput.tweets.push(outputTweet)
}

fs.writeFileSync('thread-list.json', 'const data = ' + JSON.stringify(filteredOutput, null, 2), 'utf8')

// Generate RSS (Atom) feed
// -----------------------------------------

const feed = new Feed({
  title: `${filteredOutput.account.accountDisplayName}’s Twitter threads`,
  description: `An automatically-generated list of Twitter threads from @${filteredOutput.account.username}`,
  generator: 'https://github.com/mwichary/twitter-thread-list',
})

for (let i in threadTweetsSortedByLastUpdatedDate) {
  const tweet = threadTweetsSortedByLastUpdatedDate[i]

  feed.addItem({
    title: tweet.full_text,
    content: `Thread with ${tweet.thread_length} tweets. ` + 
    `Created on ${new Date(tweet.created_at).toDateString()}, last updated on ${new Date(tweet.last_updated_at).toDateString()}.`,
    link: `https://twitter.com/${filteredOutput.account.username}/status/${tweet.id_str}`,
    date: new Date(tweet.last_updated_at)
  })
}
github twigjs / twig.js / demos / twitter_backbone / js / view / feedView.js View on Github external
, function (require, exports, module) {
        var feed = require("feed").feed
            , Backbone = require("backbone")
            , TweetView = require("tweetView").TweetView

            // The FeedView is a simple container of TweetViews and therefore
            // doesn't need a template. The ul element provided by the Backbone
            // View is sufficient.
            , FeedView = Backbone.View.extend({
                tagName: "ul"
                , className: "feed"

                , initialize: function() {
                    // Bind to model changes
                    feed.bind('add',   this.addTweet, this);
                    feed.bind('reset', this.addAll,   this);

                    // Load stored tweets from local storage
github twigjs / twig.js / demos / twitter_backbone / js / view / appView.js View on Github external
, function (require, exports, module) {
        var twig = require("twig").twig
            , Backbone = require("backbone")
            , feed = require("feed").feed

            // The application template
            , template = twig({
                href: 'templates/app.twig'
                , async: false
            })
            
            , FeedView = require("feedView").FeedView
            , feedView = new FeedView

            , AppView = Backbone.View.extend({
                tagName: "div"
                , className: "app"

                // Bind to the buttons in the template
                , events: {
github twigjs / twig.js / demos / twitter_backbone / js / view / feedView.js View on Github external
, initialize: function() {
                    // Bind to model changes
                    feed.bind('add',   this.addTweet, this);
                    feed.bind('reset', this.addAll,   this);

                    // Load stored tweets from local storage
                    feed.fetch();
                }
github twigjs / twig.js / demos / twitter_backbone / js / view / feedView.js View on Github external
, initialize: function() {
                    // Bind to model changes
                    feed.bind('add',   this.addTweet, this);
                    feed.bind('reset', this.addAll,   this);

                    // Load stored tweets from local storage
                    feed.fetch();
                }
github twigjs / twig.js / demos / twitter_backbone / js / view / feedView.js View on Github external
, initialize: function() {
                    // Bind to model changes
                    feed.bind('add',   this.addTweet, this);
                    feed.bind('reset', this.addAll,   this);

                    // Load stored tweets from local storage
                    feed.fetch();
                }

feed

Feed is a RSS, Atom and JSON feed generator for Node.js, making content syndication simple and intuitive!

MIT
Latest version published 3 years ago

Package Health Score

64 / 100
Full package analysis