import { defineConfig } from 'vitepress' import { groupIconMdPlugin, groupIconVitePlugin } from 'vitepress-plugin-group-icons' import { GitChangelog, GitChangelogMarkdownSection, } from '@nolebase/vitepress-plugin-git-changelog/vite' import footnote from 'markdown-it-footnote' import mark from 'markdown-it-mark' import sub from 'markdown-it-sub' import taskLists from 'markdown-it-task-lists' export default defineConfig({ title: 'SukiSU-Ultra', description: 'Next-Generation Android root solution.', lastUpdated: true, cleanUrls: true, metaChunk: true, // Global performance optimizations cacheDir: './.vitepress/cache', ignoreDeadLinks: false, // Enhanced markdown with performance focus markdown: { math: true, config(md) { md.use(groupIconMdPlugin) md.use(footnote) md.use(mark) md.use(sub) md.use(taskLists) }, linkify: true, typographer: true, lineNumbers: true, image: { lazyLoading: true, }, toc: { level: [1, 2, 3], }, theme: { light: 'github-light', dark: 'github-dark', }, }, sitemap: { hostname: 'https://sukisu.org', transformItems(items) { return items .filter((item) => !item.url.includes('404')) .map((item) => ({ ...item, changefreq: item.url === '/' ? 'daily' : item.url.includes('/guide/') ? 'weekly' : 'monthly', priority: item.url === '/' ? 1.0 : item.url.includes('/guide/') ? 0.9 : 0.7, })) }, }, // Critical performance transformations transformPageData(pageData) { const canonicalUrl = `https://sukisu.org${pageData.relativePath}` .replace(/index\.md$/, '') .replace(/\.md$/, '') pageData.frontmatter.head ??= [] pageData.frontmatter.head.push( ['link', { rel: 'canonical', href: canonicalUrl }], ['meta', { property: 'og:url', content: canonicalUrl }], ['link', { rel: 'preload', href: '/logo.svg', as: 'image' }] ) return pageData }, head: [ // Critical resource hints for global performance ['link', { rel: 'dns-prefetch', href: '//github.com' }], ['link', { rel: 'dns-prefetch', href: '//t.me' }], ['link', { rel: 'dns-prefetch', href: '//sukisu.org' }], // Essential favicon setup - synced from /favicon during build/dev ['link', { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }], ['link', { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' }], ['link', { rel: 'icon', type: 'image/png', sizes: '96x96', href: '/favicon-96x96.png' }], ['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }], ['link', { rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#64edff' }], // (Removed msapplication meta to avoid referencing non-existent files) // Web App Manifest ['link', { rel: 'manifest', href: '/site.webmanifest' }], // Theme and app configuration ['meta', { name: 'theme-color', content: '#64edff' }], ['meta', { name: 'application-name', content: 'SukiSU-Ultra' }], ['meta', { name: 'apple-mobile-web-app-title', content: 'SukiSU-Ultra' }], ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }], ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'default' }], // Viewport and mobile optimization [ 'meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0, viewport-fit=cover' }, ], ['meta', { name: 'format-detection', content: 'telephone=no' }], ['meta', { property: 'og:type', content: 'website' }], ['meta', { property: 'og:site_name', content: 'SukiSU-Ultra' }], ['meta', { property: 'og:url', content: 'https://sukisu.org/' }], ['meta', { property: 'og:locale', content: 'en_US' }], ['meta', { property: 'og:locale:alternate', content: 'zh_CN' }], // Twitter optimization for global audience ['meta', { property: 'twitter:card', content: 'summary_large_image' }], ['meta', { property: 'twitter:site', content: '@sukisu_ultra' }], ['meta', { property: 'twitter:creator', content: '@sukisu_ultra' }], // (Removed Twitter image as no PNG social image is provided) // Additional SEO optimizations [ 'meta', { name: 'robots', content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1', }, ], ['meta', { name: 'bingbot', content: 'index, follow' }], ['meta', { name: 'referrer', content: 'strict-origin-when-cross-origin' }], // Global SEO optimization [ 'meta', { name: 'keywords', content: 'Android root, KernelSU, SukiSU-Ultra, Android kernel, root management, 安卓 root, カーネル, рут', }, ], ['meta', { name: 'author', content: 'SukiSU-Ultra Team' }], // Enhanced structured data for global search engines [ 'script', { type: 'application/ld+json' }, JSON.stringify({ '@context': 'https://schema.org', '@type': 'SoftwareApplication', name: 'SukiSU-Ultra', description: 'Next-Generation Android Root Solution', applicationCategory: 'SystemApplication', operatingSystem: 'Android', url: 'https://sukisu.org', downloadUrl: 'https://github.com/sukisu-ultra/sukisu-ultra/releases', supportingData: { '@type': 'DataCatalog', name: 'Compatibility Database', }, offers: { '@type': 'Offer', price: '0', priceCurrency: 'USD', }, author: { '@type': 'Organization', name: 'SukiSU-Ultra Team', url: 'https://github.com/sukisu-ultra', }, }), ], // PWA optimization for global mobile users (manifest declared above) ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }], ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }], ['meta', { name: 'apple-mobile-web-app-title', content: 'SukiSU-Ultra' }], // Cloudflare Web Analytics [ 'script', { defer: '', src: 'https://static.cloudflareinsights.com/beacon.min.js', 'data-cf-beacon': '{"token": "dcc5feef58bf4c56a170a99f4cec4798"}', }, ], ], themeConfig: { logo: { src: '/logo.svg', width: 24, height: 24 }, socialLinks: [ { icon: 'github', link: 'https://github.com/sukisu-ultra/sukisu-ultra' }, { icon: { svg: '', }, link: 'https://t.me/sukiksu', }, ], search: { provider: 'local', }, }, rewrites: { 'en/:rest*': ':rest*', }, locales: { root: { label: 'English', }, zh: { label: '简体中文', link: '/zh/', }, }, vite: { plugins: [ groupIconVitePlugin({ customIcon: { bash: '', }, }), GitChangelog({ repoURL: () => 'https://github.com/SukiSU-Ultra/Website' }), GitChangelogMarkdownSection({ exclude: (id) => id.endsWith('index.md'), sections: { disableContributors: true }, }), ], build: { minify: 'terser', chunkSizeWarningLimit: 800, assetsInlineLimit: 8192, target: 'esnext', cssCodeSplit: true, sourcemap: false, }, server: { fs: { allow: ['..'], }, }, }, })