Skip to content

Commit

Permalink
feat(plugin-feed): add feed plugin (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope authored Jan 31, 2024
1 parent bd72368 commit b0b2aa4
Show file tree
Hide file tree
Showing 61 changed files with 5,635 additions and 3 deletions.
4 changes: 4 additions & 0 deletions docs/.vuepress/configs/navbar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export const navbarEn: NavbarConfig = [
text: 'Search',
children: ['/plugins/docsearch', '/plugins/search'],
},
{
text: 'Blogging',
children: ['/plugins/feed/'],
},
{
text: 'PWA',
children: ['/plugins/pwa', '/plugins/pwa-popup'],
Expand Down
4 changes: 4 additions & 0 deletions docs/.vuepress/configs/navbar/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ export const navbarZh: NavbarConfig = [
text: '搜索',
children: ['/zh/plugins/docsearch', '/zh/plugins/search'],
},
{
text: '博客',
children: ['/plugins/feed/'],
},
{
text: 'PWA',
children: ['/zh/plugins/pwa', '/zh/plugins/pwa-popup'],
Expand Down
17 changes: 17 additions & 0 deletions docs/.vuepress/configs/sidebar/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ export const sidebarEn: SidebarConfig = {
text: 'Content Search',
children: ['/plugins/docsearch', '/plugins/search'],
},
{
text: 'Blogging',
children: [
{
text: 'Feed',
link: '/plugins/feed/',
children: [
'/plugins/feed/guide',
'/plugins/feed/config',
'/plugins/feed/frontmatter',
'/plugins/feed/channel',
'/plugins/feed/getter',
],
},
],
},
{
text: 'PWA',
children: ['/plugins/pwa', '/plugins/pwa-popup'],
Expand All @@ -27,6 +43,7 @@ export const sidebarEn: SidebarConfig = {
children: [
{
text: 'Sitemap',
link: '/plugins/sitemap/',
children: [
'/plugins/sitemap/guide',
'/plugins/sitemap/config',
Expand Down
17 changes: 17 additions & 0 deletions docs/.vuepress/configs/sidebar/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ export const sidebarZh: SidebarConfig = {
text: '搜索',
children: ['/zh/plugins/docsearch', '/zh/plugins/search'],
},
{
text: '博客',
children: [
{
text: 'Feed',
link: '/zh/plugins/feed/',
children: [
'/zh/plugins/feed/guide',
'/zh/plugins/feed/config',
'/zh/plugins/feed/frontmatter',
'/zh/plugins/feed/channel',
'/zh/plugins/feed/getter',
],
},
],
},
{
text: 'PWA',
children: ['/zh/plugins/pwa', '/zh/plugins/pwa-popup'],
Expand All @@ -27,6 +43,7 @@ export const sidebarZh: SidebarConfig = {
children: [
{
text: '站点地图',
link: '/zh/plugins/sitemap/',
children: [
'/zh/plugins/sitemap/guide',
'/zh/plugins/sitemap/config',
Expand Down
21 changes: 21 additions & 0 deletions docs/plugins/feed/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# feed

<NpmBadge package="@vuepress/plugin-feed" />

## Usage

```bash
npm i -D @vuepress/plugin-feed@next
```

```ts title=".vuepress/config.ts"
import { feedPlugin } from "@vuepress/plugin-feed";

export default {
plugins: [
feedPlugin({
// options
}),
],
}
```
120 changes: 120 additions & 0 deletions docs/plugins/feed/channel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
# Channel Config

The channel plugin option is used to config the feed channel.

## channel.title

- Type: `string`
- Default: `SiteConfig.title`

Channel title

## channel.link

- Type: `string`
- Default: Deployment link (generated by `options.hostname` and `context.base`)

Channel address

## channel.description

- Type: `string`
- Default: `SiteConfig.description`

Channel description

## channel.language

- Type: `string`

- Default:
- `siteConfig.locales['/'].lang`
- If the above is not provided, fall back to `"en-US"`

The language of the channel

## channel.copyright

- Type: `string`

- Default:

- Try to read the `author.name` in channel options, and fall back to `Copyright by $author`

- Recommended to set manually: **Yes**

Channel copyright information

## channel.pubDate

- Type: `string` (must be a valid Date ISOString)
- Default: time when the plugin is called each time
- Recommended to set manually: **Yes**

Publish date of the Channel

## channel.lastUpdated

- Type: `string` (must be a valid Date ISOString)
- Default: time when the plugin is called each time

Last update time of channel content

## channel.ttl

- Type: `number`
- Recommended to set manually: **Yes**

The effective time of the content. It's the time to keep the cache after request without making new requests.

## channel.image

- Type: `string`
- Recommended to set manually: **Yes**

A picture presenting the channel. A square picture with a size not smaller than 512×512 is recommended.

## channel.icon

- Type: `string`
- Recommended to set manually: **Yes**

An icon representing a channel, a square picture, with not less than 128×128 in size, and transparent background color is recommended.

## channel.author

- Type: `FeedAuthor`
- Recommended to set manually: **Yes**

The author of the channel.

::: details FeedAuthor format

```ts
interface FeedAuthor {
/** Author name */
name: string;
/** Author's email */
email?: string;
/** Author's site */
url?: string;
/**
* Author's avatar address
*
* Square, preferably not less than 128×128 with transparent background
*/
avatar?: string;
}
```

## channel.hub

- Type: `string`

Link to Websub. Websub requires a server backend, which is inconsistent with VuePress, so ignore it if there is no special need.

::: tip WebSub

For details, see [Websub](https://w3c.github.io/websub/#subscription-migration).

:::
Loading

0 comments on commit b0b2aa4

Please sign in to comment.