From e23f8bee96154ed9a45c3f475d802ea6d878d25c Mon Sep 17 00:00:00 2001 From: radishzzz Date: Sat, 15 Mar 2025 22:23:55 +0000 Subject: [PATCH] chore: update theme intro and i18n meta tag --- .gitattributes | 1 - README.md | 10 ++++++++-- README.zh.md | 10 ++++++++-- src/config.ts | 2 +- src/layouts/Head.astro | 19 ++++++++++--------- 5 files changed, 27 insertions(+), 15 deletions(-) delete mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 6cc5de0..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -*.mdx linguist-detectable=false diff --git a/README.md b/README.md index e79238e..9b4a73d 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,14 @@ Retypeset is a static blog theme based on the [Astro](https://astro.build/) framework, inspired by [Typography](https://astro-theme-typography.vercel.app/). Retypeset establishes a new visual standard and reimagines the layout of all pages, offering a reading experience similar to paper books, reviving the beauty of typography. Details in every sight, elegance in every space. -- [Live Demo](https://retypeset.radishzz.cc/) -- [Mobile design](https://mastergo.com/file/151079538766773?fileOpenFrom=home&page_id=M&source=link_share&shareId=151079538766773) +## Demo + +- [Retypeset](https://retypeset.radishzz.cc/en/) +- [Retipografía](https://retypeset.radishzz.cc/en/) +- [Переверстка](https://retypeset.radishzz.cc/en/) +- [重新编排](https://retypeset.radishzz.cc/en/) +- [重新編排](https://retypeset.radishzz.cc/en/) +- [再組版](https://retypeset.radishzz.cc/en/) ## Features diff --git a/README.zh.md b/README.zh.md index 95a8477..c4e6010 100644 --- a/README.zh.md +++ b/README.zh.md @@ -21,8 +21,14 @@ Retypeset 是一款基于 [Astro](https://astro.build/) 框架的静态博客主题,设计灵感来自 [Typography](https://astro-theme-typography.vercel.app/)。本主题通过建立全新的视觉规范,对所有页面进行重新编排,打造纸质书页般的阅读体验,再现版式之美。所见皆为细节,方寸尽显优雅。 -- [在线预览](https://retypeset.radishzz.cc/) -- [移动端设计稿](https://mastergo.com/file/151079538766773?fileOpenFrom=home&page_id=M&source=link_share&shareId=151079538766773) +## 预览 + +- [重新编排](https://retypeset.radishzz.cc/en/) +- [重新編排](https://retypeset.radishzz.cc/en/) +- [再組版](https://retypeset.radishzz.cc/en/) +- [Retypeset](https://retypeset.radishzz.cc/en/) +- [Retipografía](https://retypeset.radishzz.cc/en/) +- [Переверстка](https://retypeset.radishzz.cc/en/) ## 特征 diff --git a/src/config.ts b/src/config.ts index 0dc8e24..48129a3 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,7 +6,7 @@ export const themeConfig: ThemeConfig = { // site title title: 'Retypeset', // site subtitle - subtitle: '再现版式之美', + subtitle: 'Revive the beauty of typography', // use i18n title/subtitle from src/i18n/ui.ts instead of static ones above i18nTitle: true, // site description diff --git a/src/layouts/Head.astro b/src/layouts/Head.astro index 442fa9c..34a8fa6 100644 --- a/src/layouts/Head.astro +++ b/src/layouts/Head.astro @@ -1,5 +1,7 @@ --- import { allLocales, defaultLocale, themeConfig } from '@/config' +import { ui } from '@/i18n/ui' +import { getPageInfo } from '@/utils/page' import { ClientRouter } from 'astro:transitions' interface Props { @@ -9,16 +11,19 @@ interface Props { } const { postTitle, postDescription, postSlug } = Astro.props +const { currentLang } = getPageInfo(Astro.url.pathname) +const currentUI = ui[currentLang as keyof typeof ui] -const { title, subtitle, description, author, url, favicon } = themeConfig.site +const { title, subtitle, description, author, url, favicon, i18nTitle } = themeConfig.site const { mode, light: { background: lightMode }, dark: { background: darkMode } } = themeConfig.color -// const { locale, moreLocales } = themeConfig.global const { verification = {}, twitterID = '', googleAnalyticsID = '', umamiAnalyticsID = '' } = themeConfig.seo ?? {} const { google = '', bing = '', yandex = '', baidu = '' } = verification const { commentURL = '', imageHostURL = '', customGoogleAnalyticsJS = '', customUmamiAnalyticsJS = '' } = themeConfig.preload const initMetaTheme = mode === 'dark' ? darkMode : lightMode -const pageTitle = postTitle ? `${postTitle} | ${title}` : `${title} - ${subtitle}` +const headTitle = i18nTitle ? currentUI.title : title +const headSubtitle = i18nTitle ? currentUI.subtitle : subtitle +const pageTitle = postTitle ? `${postTitle} | ${headTitle}` : `${headTitle} - ${headSubtitle}` const pageDescription = postDescription || description // TODO: Change openGraph image fallback url const pageImage = postSlug ? `${url}/opengraph/${postSlug}.png` : 'https://placehold.co/1200x630' @@ -69,12 +74,8 @@ const pageImage = postSlug ? `${url}/opengraph/${postSlug}.png` : 'https://place -{twitterID && ( - <> - - - -)} +{twitterID && } +{twitterID && } {google && }