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>
|
||||
|
|
|
@ -4,7 +4,7 @@ import Layout from '../layouts/Layout.astro';
|
|||
const url = Astro.url.pathname
|
||||
---
|
||||
|
||||
<Layout title="404 | Terminal Blog" description="Page not found">
|
||||
<Layout title="404" description="Page not found">
|
||||
<h1 class="title">command not found.</h1>
|
||||
|
||||
<div class="content">
|
||||
|
|
|
@ -13,7 +13,7 @@ const { Content } = await entry.render();
|
|||
|
||||
---
|
||||
|
||||
<Layout title={`${entry.data.title} | Terminal Blog`} path={`/var/log/${entry.slug}`} description={entry.data.description} >
|
||||
<Layout title={entry.data.title} description={entry.data.description} >
|
||||
<h1 class="title">{entry.data.title}</h1>
|
||||
<div class="content">
|
||||
<Content/>
|
||||
|
|
|
@ -6,7 +6,7 @@ const posts = await getCollection('posts');
|
|||
posts.sort((a, b) => new Date(b.data.pubDate).getTime() - new Date(a.data.pubDate).getTime());
|
||||
---
|
||||
|
||||
<Layout title="Blog | Terminal Blog" description="List all files and folders in the directory.">
|
||||
<Layout title="Blog Posts" description="List all files and folders in the directory.">
|
||||
<h1 class="title">~/blog</h1>
|
||||
|
||||
<div class="content">
|
||||
|
|
|
@ -3,7 +3,7 @@ import Layout from '../layouts/Layout.astro';
|
|||
|
||||
---
|
||||
|
||||
<Layout title="Home | Terminal Blog" description="That a good start.">
|
||||
<Layout description="That a good start.">
|
||||
<h1 class="title">~/</h1>
|
||||
<div class="content">
|
||||
<h3>Welcome!</h3>
|
||||
|
|
|
@ -35,7 +35,6 @@ const cover = customFeaturedImage || matchedImage_src?.src || `/post/${slug}/fea
|
|||
|
||||
<Layout
|
||||
title={entry.data.title}
|
||||
path={`~/grassblock/micr0blog/blog/${slug}`}
|
||||
description={entry.data.description}
|
||||
ogImage={cover}
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue