-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
3,868 additions
and
3,057 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
dist | ||
posts | ||
public | ||
public | ||
.vitepress/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
npx --no-install lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
dist | ||
.vitepress/cache | ||
node_modules | ||
.DS_Store | ||
.idea | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
dist | ||
.eslintrc.js | ||
.eslintrc.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import fs from 'node:fs' | ||
import path from 'node:path' | ||
import { Feed } from 'feed' | ||
import { createContentLoader } from 'vitepress' | ||
|
||
import type { SiteConfig } from 'vitepress' | ||
|
||
const baseUrl = `https://blog.intlify.dev` | ||
|
||
export async function genFeed(config: SiteConfig) { | ||
const feed = new Feed({ | ||
title: 'The Intlify World', | ||
description: 'The offical blog for the Intlify project', | ||
id: baseUrl, | ||
link: baseUrl, | ||
language: 'en', | ||
image: `${baseUrl}/logo.png`, | ||
favicon: `${baseUrl}/favicon.ico`, | ||
copyright: | ||
'Copyright (c) 2021-present, Kazuya Kawaguchi and blog contributors' | ||
}) | ||
|
||
const posts = await createContentLoader('posts/*.md', { | ||
excerpt: true, | ||
render: true | ||
}).load() | ||
|
||
posts.sort( | ||
(a, b) => | ||
+new Date(b.frontmatter.date as string) - | ||
+new Date(a.frontmatter.date as string) | ||
) | ||
|
||
for (const { url, excerpt, frontmatter, html } of posts) { | ||
feed.addItem({ | ||
title: frontmatter.title, | ||
id: `${baseUrl}${url}`, | ||
link: `${baseUrl}${url}`, | ||
description: excerpt, | ||
content: html, | ||
author: [ | ||
{ | ||
name: frontmatter.author, | ||
link: frontmatter.twitter | ||
? `https://x.com/${frontmatter.twitter}` | ||
: undefined | ||
} | ||
], | ||
date: frontmatter.date | ||
}) | ||
} | ||
|
||
fs.writeFileSync(path.join(config.outDir, 'feed.rss'), feed.rss2()) | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.