Skip to content

Commit

Permalink
feat: custom website domain, fix rss metadata (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz authored Aug 29, 2024
1 parent 0a2bb82 commit 595dd30
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
1 change: 1 addition & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
GITHUB_TOKEN=your_token
GITHUB_LOGIN=antfu
GITHUB_NAME=Anthony Fu
WEBSITE_DOMAIN=https://releases.antfu.me
6 changes: 4 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import process from 'node:process'

const name = process.env.GITHUB_NAME || 'Anthony Fu'
const login = process.env.GITHUB_LOGIN || 'antfu'
const website = process.env.WEBSITE_DOMAIN || 'https://releases.antfu.me'

export default defineNuxtConfig({
modules: [
Expand All @@ -16,6 +17,7 @@ export default defineNuxtConfig({
public: {
name,
login,
website,
},
},

Expand Down Expand Up @@ -46,10 +48,10 @@ export default defineNuxtConfig({
{ name: 'description', content: `${name}'s recent releases` },
{ name: 'theme-color', media: '(prefers-color-scheme: light)', content: 'white' },
{ name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#222222' },
{ property: 'og:image', content: 'https://releases.antfu.me/og.png' },
{ property: 'og:image', content: `${website}/og.png` },
{ property: 'og:image:alt', content: `${name} is Releasing...` },
{ name: 'twitter:card', content: 'summary_large_image' },
{ name: 'twitter:image', content: 'https://releases.antfu.me/og.png' },
{ name: 'twitter:image', content: `${website}/og.png` },
{ name: 'twitter:image:alt', content: `${name} is Releasing...` },
],
},
Expand Down
21 changes: 11 additions & 10 deletions server/routes/feed.xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import { Feed } from 'feed'
import { joinURL } from 'ufo'
import { logoOverrides } from '~~/shared/constants'

const DOMAIN = 'https://releases.antfu.me'

export default defineEventHandler(async (event) => {
const config = useRuntimeConfig()
const { name, website } = config.public

const feed = new Feed({
title: 'Anthony Fu is Releasing...',
description: 'Anthony Fu\'s recent releases',
id: DOMAIN,
link: DOMAIN,
title: `${name} is Releasing...`,
description: `${name}'s recent releases`,
id: website,
link: website,
language: 'en',
image: joinURL(DOMAIN, 'favicon.png'),
favicon: joinURL(DOMAIN, 'favicon.png'),
copyright: 'CC BY-NC-SA 4.0 2024 © Anthony Fu',
image: joinURL(website, 'favicon.png'),
favicon: joinURL(website, 'favicon.png'),
copyright: `CC BY-NC-SA 4.0 ${(new Date()).getFullYear()} © ${name}`,
feedLinks: {
rss: `${DOMAIN}/rss.xml`,
rss: `${website}/rss.xml`,
},
})

Expand Down

0 comments on commit 595dd30

Please sign in to comment.