From 2d12aac298b4b3a3c234202d6e4ae3a46593c118 Mon Sep 17 00:00:00 2001 From: Zakhar Timoshenko Date: Wed, 25 Oct 2023 18:00:35 +0300 Subject: [PATCH] chore: test applink --- .vitepress/config/hooks/generateMeta.ts | 15 +++++++++++++++ .vitepress/config/index.ts | 17 +---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.vitepress/config/hooks/generateMeta.ts b/.vitepress/config/hooks/generateMeta.ts index 89a2bee..9a1e983 100644 --- a/.vitepress/config/hooks/generateMeta.ts +++ b/.vitepress/config/hooks/generateMeta.ts @@ -7,6 +7,15 @@ function generateMeta(context: TransformContext, hostname: string) { const url = `${hostname}/${pageData.relativePath.replace(/((^|\/)index)?\.md$/, "$2")}` + head.push(['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }]) + head.push(['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }]) + head.push(['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap' }]) + + head.push(['link', { rel: 'icon', href: '/favicon.ico?v=2', sizes: 'any' }]) + head.push(['link', { rel: 'icon', href: '/logo-compact.svg?v=2', type: 'image/svg+xml' }]) + head.push(['link', { rel: 'apple-touch-icon', href: '/apple-touch-icon.png?v=2' }]) + head.push(['link', { rel: 'manifest', href: '/site.webmanifest' }]) + head.push(["link", { rel: "canonical", href: url }]) head.push(["meta", { property: "og:url", content: url }]) head.push(["meta", { name: "twitter:url", content: url }]) @@ -104,6 +113,12 @@ function generateMeta(context: TransformContext, hostname: string) { }, ]) } + if (pageData.filePath === "manga/index.md") { + head.push(["meta", { property: "al:android:url", content: "kotatsu://manga" }]) + head.push(["meta", { property: "al:android:app_name", content: "Kotatsu" }]) + head.push(["meta", { property: "al:android:package", content: "org.koitharu.kotatsu" }]) + head.push(["script", {}, `window.location = "kotatsu://manga"`]) + } return head } diff --git a/.vitepress/config/index.ts b/.vitepress/config/index.ts index 2dea420..65846f1 100644 --- a/.vitepress/config/index.ts +++ b/.vitepress/config/index.ts @@ -9,7 +9,7 @@ import { slugify } from 'transliteration' import { fileURLToPath, URL } from 'node:url' import { telegram } from '../../website/icons' import { tabsMarkdownPlugin } from "vitepress-plugin-tabs" -import pluginRewriteAll from 'vite-plugin-rewrite-all'; +import pluginRewriteAll from 'vite-plugin-rewrite-all' import shortcode_plugin from "markdown-it-shortcode-tag" import shortcodes from "./shortcodes" @@ -56,21 +56,6 @@ export default defineConfigWithTheme({ }, }, - head: [ - ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }], - ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }], - ['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap' }], - - ['link', { rel: 'icon', href: '/favicon.ico?v=2', sizes: 'any' }], - ['link', { rel: 'icon', href: '/logo-compact.svg?v=2', type: 'image/svg+xml' }], - ['link', { rel: 'apple-touch-icon', href: '/apple-touch-icon.png?v=2' }], - ['link', { rel: 'manifest', href: '/site.webmanifest' }], - - ["meta", { property: "al:android:url", content: "kotatsu://manga" }], - ["meta", { property: "al:android:app_name", content: "Kotatsu" }], - ["meta", { property: "al:android:package", content: "org.koitharu.kotatsu.debug" }] - ], - themeConfig: { titleSeparator: SITE_TITLE_SEPARATOR, i18nRouting: true,