feat: a more adaptive way to show the title & remove redundant path
This commit is contained in:
parent
d33b2be49e
commit
ba9a44a944
6 changed files with 9 additions and 8 deletions
|
@ -18,11 +18,13 @@ const formattedRootPath = defaultTitle.toLowerCase().replace(/\s+/g, '-');
|
|||
const relativePath = Astro.url.pathname
|
||||
const path = formattedRootPath + (relativePath === '/' ? '' : relativePath)
|
||||
|
||||
const pageTitle = (relativePath === '/' ? defaultTitle : `${Astro.props.title} - ${defaultTitle}`)
|
||||
|
||||
const navBarItems = siteConfig.navBarItems
|
||||
const customFooter = siteConfig.customFooter
|
||||
const nekoType = siteConfig.neko?.type
|
||||
|
||||
const { title, description = siteConfig.description, ogImage = "" } = Astro.props;
|
||||
const { title = pageTitle, description = siteConfig.description, ogImage = "" } = Astro.props;
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
|
@ -32,8 +34,8 @@ const { title, description = siteConfig.description, ogImage = "" } = Astro.prop
|
|||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<Meta title={title} description={description} ogImage={ogImage} />
|
||||
<title>{title}</title>
|
||||
<Meta title={pageTitle} description={description} ogImage={ogImage} />
|
||||
<title>{pageTitle}</title>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue