Skip to content

Commit 034ffd6

Browse files
committed
Don't generate files to /public
1 parent c8a0147 commit 034ffd6

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

modules/blog.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import MarkdownItAnchor from 'markdown-it-anchor'
66
import { defu } from 'defu'
77
import { read } from 'gray-matter'
88
import { array, safeParse } from 'valibot'
9-
import { Feed } from 'feed'
109
import {
1110
AuthorSchema,
1211
RawBlogPostSchema,
@@ -160,7 +159,6 @@ export default defineNuxtModule({
160159
const resolver = createResolver(import.meta.url)
161160
const blogDir = resolver.resolve('../app/pages/blog')
162161
const blogImagesDir = resolver.resolve('../public/blog/avatar')
163-
const publicDir = resolver.resolve('../public')
164162
const resolveAvatars = !nuxt.options._prepare
165163

166164
nuxt.options.extensions.push('.md')
@@ -223,52 +221,5 @@ export default defineNuxtModule({
223221
}
224222
}
225223
}
226-
227-
// Generate content for RSS, Atom and JSON feeds
228-
const feed = new Feed({
229-
title: 'Blog - npmx',
230-
description: 'a fast, modern browser for the npm registry',
231-
id: 'https://npmx.dev/',
232-
link: 'https://npmx.dev/',
233-
language: 'en',
234-
image: 'https://npmx.dev/logo.svg',
235-
favicon: 'https://npmx.dev/favicon.ico',
236-
feedLinks: {
237-
rss: 'https://npmx.dev/rss.xml',
238-
atom: 'https://npmx.dev/atom.xml',
239-
json: 'https://npmx.dev/feed.json',
240-
},
241-
})
242-
243-
allPosts
244-
.filter(post => !post.draft)
245-
.forEach(post => {
246-
feed.addItem({
247-
title: post.title,
248-
id: new URL(post.path, 'https://npmx.dev').toString(),
249-
link: new URL(post.path, 'https://npmx.dev').toString(),
250-
description: post.description,
251-
author: post.authors.map(author => ({
252-
name: author.name,
253-
link: author.profileUrl ?? undefined,
254-
// author.avatar is a relative URL - make it absolute to work in feed readers
255-
avatar: author.avatar
256-
? new URL(author.avatar, 'https://npmx.dev').toString()
257-
: undefined,
258-
})),
259-
date: new Date(post.date),
260-
image: post.image,
261-
})
262-
})
263-
264-
const rssPath = 'rss.xml'
265-
const atomPath = 'atom.xml'
266-
const jsonFeedPath = 'feed.json'
267-
268-
await Promise.all([
269-
writeFile(join(publicDir, rssPath), feed.rss2()),
270-
writeFile(join(publicDir, atomPath), feed.atom1()),
271-
writeFile(join(publicDir, jsonFeedPath), feed.json1()),
272-
])
273224
},
274225
})

0 commit comments

Comments
 (0)