feat: fully dynamic title path

This commit is contained in:
grassblock 2025-05-16 18:34:08 +08:00
parent 77c56236f9
commit 6a2d5fd912

View file

@ -14,14 +14,15 @@ interface Props {
} }
const defaultTitle = siteConfig.title const defaultTitle = siteConfig.title
const formattedPath = defaultTitle.toLowerCase().replace(/\s+/g, '-'); const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-');
const relativePath = Astro.url.pathname
const path = formattedRootPath + (relativePath === '/' ? '' : relativePath)
const navBarItems = siteConfig.navBarItems const navBarItems = siteConfig.navBarItems
const customFooter = siteConfig.customFooter const customFooter = siteConfig.customFooter
const nekoType = siteConfig.neko?.type const nekoType = siteConfig.neko?.type
const { title, path = formattedPath, description = siteConfig.description, ogImage = "" } = Astro.props; const { title, description = siteConfig.description, ogImage = "" } = Astro.props;
// TODO: make the path dynamic
--- ---
<!doctype html> <!doctype html>