ElMassimo / iles

šŸ The joyful site generator
https://iles.pages.dev
MIT License
1.08k stars 31 forks source link

feat: create @islands/feed module to generate RSS, Atom, and JSON feeds #57

Closed ElMassimo closed 2 years ago

ElMassimo commented 2 years ago

Description šŸ“–

This pull request adds a new @islands/feed module powered by feed:

Usage šŸš€

To generate a feed, create a Vue SFC and specify a path with the appropriate extension:

<page>
path: /feed.atom
</page>

<script setup lang="ts">
import type { FeedOptions, FeedItem } from '@islands/feed'

const { site } = usePage()

const url = site.url

const options: FeedOptions = {
  title: 'The Vue Point',
  description: 'The official blog for the Vue.js project',
  id: url,
  link: url,
  language: 'en',
  image: 'https://vuejs.org/images/logo.png',
  copyright: 'Copyright (c) 2021-present',
}

const posts = Object.values(import.meta.globEagerDefault('./posts/**/*.mdx'))

const items = posts.map<FeedItem>(post => ({
  link: `${url}${post.href}`,
  date: new Date(post.date),
  title: post.title,
  description: post.description,
  content: post,
}))
</script>

<template>
  <RenderFeed format="atom" :options="options" :items="items"/>
</template>

Check the feed documentation for more information.

netlify[bot] commented 2 years ago

āœ”ļø Deploy Preview for the-vue-point-with-iles canceled.

šŸ”Ø Explore the source changes: ed4ef8358823bda687e9f7b62c44f75f3f37de4f

šŸ” Inspect the deploy log: https://app.netlify.com/sites/the-vue-point-with-iles/deploys/61b3e2c9a5ead3000804b6f2

netlify[bot] commented 2 years ago

āœ”ļø Deploy Preview for iles-docs canceled.

šŸ”Ø Explore the source changes: ed4ef8358823bda687e9f7b62c44f75f3f37de4f

šŸ” Inspect the deploy log: https://app.netlify.com/sites/iles-docs/deploys/61b3e2ca3a000b0007740008

cloudflare-pages[bot] commented 2 years ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: b741b91
Status: āœ…  Deploy successful!
Preview URL: https://6a33e994.iles.pages.dev

View logs