chore: delete Open Graph configuration and change favicon format

This commit is contained in:
radishzzz 2025-03-13 06:26:49 +00:00
parent a556a622ab
commit db1bffb4c2
6 changed files with 9 additions and 19 deletions

View file

@ -14,8 +14,8 @@ export const themeConfig: ThemeConfig = {
// site url
url: 'https://retypeset.radishzz.cc',
// favicon url
// support only ico or png for best compatibility with Open Graph and RSS avatar
favicon: '/image/Astro-Icon.png', // https://example.com/logo.png
// support only SVG, PNG and ICO
favicon: '/image/Astro-Icon-Dark.svg', // https://example.com/favicon.svg
},
// SITE INFORMATION >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END
@ -121,10 +121,8 @@ export const themeConfig: ThemeConfig = {
userID: '',
},
// Open Graph
openGraph: {
// image url (1200x630)
url: '', // https://placehold.co/1200x630
},
// Screenshot of home page for Open Graph: ./public/image/Screenshot.png
// Logo on the Open Graph: ./public/image/Astro-Icon-Dark.png
},
// SEO SETTINGS >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> END

View file

@ -13,7 +13,7 @@ const { postTitle, postDescription, postSlug } = Astro.props
const { title, subtitle, description, author, url, favicon } = themeConfig.site
const { mode, light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color
const { locale, moreLocale } = themeConfig.global
const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '', openGraph: ogUrl } = themeConfig.seo ?? {}
const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '' } = themeConfig.seo ?? {}
const { google = '', bing = '', yandex = '', baidu = '' } = verification
const { commentURL = '', imageHostURL = '', customGoogleAnalyticsJS = '', customUmamiAnalyticsJS = '' } = themeConfig.preload
@ -21,13 +21,13 @@ const initMetaTheme = mode === 'dark' ? darkMode : lightMode
const pageTitle = postTitle ? `${postTitle} | ${title}` : `${title} - ${subtitle}`
const pageDescription = postDescription || description
// TODO: Change openGraph image fallback url
const openGraph = typeof ogUrl === 'string' ? ogUrl : 'https://placehold.co/1200x630'
const pageImage = postSlug ? `${url}/og/${postSlug}.png` : openGraph
const pageImage = postSlug ? `${url}/og/${postSlug}.png` : 'https://placehold.co/1200x630'
---
<head>
<!-- Basic info -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
{favicon.toLowerCase().endsWith('.svg') && <link rel="icon" type="image/svg+xml" href={favicon} />}
{favicon.toLowerCase().endsWith('.png') && <link rel="icon" type="image/png" href={favicon} />}
{favicon.toLowerCase().endsWith('.ico') && <link rel="icon" type="image/x-icon" href={favicon} />}
<title>{pageTitle}</title>

View file

@ -1,4 +1,3 @@
import { themeConfig } from '@/config'
import { generateDescription } from '@/utils/description'
import { OGImageRoute } from 'astro-og-canvas'
import { getCollection } from 'astro:content'
@ -6,11 +5,6 @@ import { getCollection } from 'astro:content'
// eslint-disable-next-line antfu/no-top-level-await
const blogEntries = await getCollection('posts')
// 确定favicon路径是完整URL还是相对路径
const logoPath = themeConfig.site.favicon.startsWith('http')
? themeConfig.site.favicon
: `./public${themeConfig.site.favicon}`
// Convert to page data objects
const pages = Object.fromEntries(
blogEntries.map(post => [
@ -30,7 +24,7 @@ export const { getStaticPaths, GET } = OGImageRoute({
title: page.title,
description: page.description,
logo: {
path: logoPath,
path: './public/image/Astro-Icon-Dark.png',
size: [80],
},
font: {

View file

@ -60,9 +60,6 @@ export interface ThemeConfig {
feedID?: string
userID?: string
}
openGraph?: {
url?: string
}
}
footer: {