diff --git a/.github/README.md b/.github/README.md index fe1986073..2b1ad1b9f 100644 --- a/.github/README.md +++ b/.github/README.md @@ -1,4 +1,4 @@ -# FMHYedit +# FMHY ![FMHY Banner](https://external-preview.redd.it/new-fmhy-website-v0-siM0tvJb685u2tZSfXkrpRANBH2IrPuVPDYmNA5Mkv0.jpg?auto=webp&s=a3185c2493e1c4da71863362f10b03c57e232974) @@ -34,5 +34,5 @@ Emoji Legend: ## 👋 Follow

- Discord  GitHub  Firefish + Discord  GitHub  Bluesky

diff --git a/.github/assets/bluesky.svg b/.github/assets/bluesky.svg new file mode 100644 index 000000000..4555983ad --- /dev/null +++ b/.github/assets/bluesky.svg @@ -0,0 +1 @@ +Bluesky diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index b14511fd7..449f3338c 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -1,5 +1,4 @@ import consola from 'consola' -import { basename } from 'pathe' import UnoCSS from 'unocss/vite' import { defineConfig } from 'vitepress' import { @@ -13,7 +12,7 @@ import { import { generateFeed, generateImages, generateMeta } from './hooks' import { defs, emojiRender, movePlugin } from './markdown/emoji' import { toggleStarredPlugin } from './markdown/toggleStarred' -import { transformer } from './transformer' +import { transforms } from './transformer' // @unocss-include @@ -57,7 +56,7 @@ export default defineConfig({ UnoCSS({ configFile: '../unocss.config.ts' }), - transformer(), + transforms(), { name: 'custom:adjust-order', configResolved(c) { @@ -120,7 +119,7 @@ export default defineConfig({ { text: '🔍 Whoogle', link: 'https://whoogle.fmhy.net/' }, { text: '🔗 Bookmarks', - link: 'https://github.com/Rust1667/make-fmhy-bookmarks' + link: 'https://github.com/fmhy/bookmarks' } ] } diff --git a/docs/.vitepress/constants.ts b/docs/.vitepress/constants.ts index 7029c71a5..b25dcbe80 100644 --- a/docs/.vitepress/constants.ts +++ b/docs/.vitepress/constants.ts @@ -11,8 +11,9 @@ export const meta = { export const commitRef = process.env.CF_PAGES && process.env.CF_PAGES_COMMIT_SHA - ? `${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}` + ? `${process.env.CF_PAGES_COMMIT_SHA.slice(0, 8)}` : 'dev' export const feedback = `Made with ❤` @@ -102,6 +103,13 @@ export const socialLinks: DefaultTheme.SocialLink[] = [ { icon: 'reddit', link: 'https://reddit.com/r/FREEMEDIAHECKYEAH' + }, + { + ariaLabel: 'Bluesky', + icon: { + svg: 'Bluesky' + }, + link: 'https://bsky.app/profile/fmhy.bsky.social' } ] diff --git a/docs/.vitepress/hooks/opengraph.ts b/docs/.vitepress/hooks/opengraph.ts index a9473dea2..74b62c505 100644 --- a/docs/.vitepress/hooks/opengraph.ts +++ b/docs/.vitepress/hooks/opengraph.ts @@ -6,6 +6,7 @@ import type { ContentData, SiteConfig } from 'vitepress' import { type SatoriOptions, satoriVue } from 'x-satori/vue' import { renderAsync } from '@resvg/resvg-js' import consola from 'consola' +import { headers } from '../transformer/constants' const __dirname = dirname(fileURLToPath(import.meta.url)) const __fonts = resolve(__dirname, '../fonts') @@ -67,19 +68,29 @@ async function generateImage({ }: GenerateImagesOptions): Promise { const { frontmatter, url } = page + const _page = getPage(url) + const title = + frontmatter.layout === 'home' + ? frontmatter.hero.name ?? frontmatter.title + : frontmatter.title + ? frontmatter.title + : _page?.title + + const description = + frontmatter.layout === 'home' + ? frontmatter.hero.tagline ?? frontmatter.description + : frontmatter.description + ? frontmatter.description + : _page?.description + + // consola.info(url, title, description) const options: SatoriOptions = { width: 1200, height: 628, fonts, props: { - title: - frontmatter.layout === 'home' - ? (frontmatter.hero.name ?? frontmatter.title) - : frontmatter.title, - description: - frontmatter.layout === 'home' - ? (frontmatter.hero.tagline ?? frontmatter.description) - : frontmatter.description + title, + description } } @@ -94,3 +105,20 @@ async function generateImage({ await writeFile(outputFile, render.asPng()) } + +function getPage(page: string) { + // Get the page name + const pageName = `${page}.md`.slice(1).split('/').at(-1) + + // Find the header + // TODO: This is a hacky way to find the header + const header = Object.entries(headers).find(([key]) => key === pageName) + if (!header) return + + const { title, description } = header[1] + + return { + title, + description + } +} diff --git a/docs/.vitepress/theme/components/WallpaperCard.vue b/docs/.vitepress/theme/components/WallpaperCard.vue index 29d6f62c5..5f028f19c 100644 --- a/docs/.vitepress/theme/components/WallpaperCard.vue +++ b/docs/.vitepress/theme/components/WallpaperCard.vue @@ -10,7 +10,9 @@ defineProps<{