Git Product home page Git Product logo

Comments (3)

adamszwaba avatar adamszwaba commented on June 20, 2024

You're free to add any other fields, bulk of the stuff here is done in getRssData.

export async function getRssData() {
  const feed = new rss({
    title: "Hanami Mastery newest episodes!",
    description: "The best way to master Hanami ruby framework!",
    feed_url: "https://hanamimastery.com/rss.xml",
    site_url: "https://hanamimastery.com",
    image_url: "https://hanamimastery.com/logo-hm.jpeg",
    managingEditor: "Sebastian Wilgosz",
    webMaster: "Sebastian Wilgosz",
    copyright: "2021 Sebastian Wilgosz",
    language: "en",
    categories: ["Ruby", "Hanami", "Web development"],
    pubDate: new Date().toLocaleString(),
    ttl: "60",
  });

  const posts = await getAllFilesFrontMatter("stray");
  const episodes = await getAllFilesFrontMatter("episodes");
  const postsWithSlug = posts.map((item) => ({
    ...item,
    url: `https://hanamimastery.com/articles/${item.slug}`,
  }));
  const episodesWithSlug = episodes.map((item) => ({
    ...item,
    url: `https://hanamimastery.com/episodes/${item.slug}`,
  }));
  const items = postsWithSlug.concat(episodesWithSlug).sort((itemA, itemB) => {
    if (itemA.id > itemB.id) return -1;
    if (itemA.id < itemB.id) return 1;
    return 0;
  });
  items.map(({ author, tags, title, id, url }) => {
    feed.item({ author, title, categories: tags, guid: id, url });
  });
  return feed;
}

Regarding sorting via file creation date - it's always going to change. During deployment, will always be the same, since the repo is being built after having been downloaded onto Vercel's machines.

A good alternative - specify written_at or created_at in font matter and then sort by this. Let me know if you run into any issues, too - dealing with time and dates in js can be gruesome.

from hanamimastery.

swilgosz avatar swilgosz commented on June 20, 2024

@adamszwaba here are some of the troubles I've noticed.

  1. http://rubyland.news/sources - This rss reader has problems parsing my feed.

image

  1. The content is not loaded (type HTML).
  2. Feedly does not show the content, when you click the single episode.
  3. Also, feedly shows ALL episodes, as published at the same time, currently 3h ago.

Screenshot_2021-07-05-22-09-34-86_1ab895e2a8c0baee42df612a40cf0390 (1)

What I've noticed, is that all my strings/text is wrapped within the ![CDATA] blocks, which are basically comments ref

from hanamimastery.

swilgosz avatar swilgosz commented on June 20, 2024

Closing for now, I'll open different issue for the RSS tweaks.

from hanamimastery.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.