docs: fix the templating setup for the <title/> in MainLayout.astro (#779)

This commit is contained in:
Caleb Jasik 2021-07-20 15:56:20 -05:00 committed by GitHub
parent 225baf1fc6
commit 6915dc688b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 2 deletions

View file

@ -67,3 +67,7 @@ export const sidebar = [
// ], // ],
// }, // },
]; ];
export const site = {
title: 'Astro Documentation',
};

View file

@ -4,6 +4,7 @@ import SiteSidebar from '../components/SiteSidebar.astro';
import ThemeToggle from '../components/ThemeToggle.tsx'; import ThemeToggle from '../components/ThemeToggle.tsx';
import DocSidebar from '../components/DocSidebar.tsx'; import DocSidebar from '../components/DocSidebar.tsx';
import MenuToggle from '../components/MenuToggle.tsx'; import MenuToggle from '../components/MenuToggle.tsx';
import { site } from "../config.ts";
const { content = {}, centered = false } = Astro.props; const { content = {}, centered = false } = Astro.props;
const headers = content?.astro?.headers; const headers = content?.astro?.headers;
@ -20,7 +21,7 @@ if (currentPage) {
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{content.title}</title> <title>{content.title ? `${content.title} 🚀 ${site.title}` : site.title}</title>
<!-- This is intentionally inlined to avoid FOUC --> <!-- This is intentionally inlined to avoid FOUC -->
<script> <script>

View file

@ -2,7 +2,7 @@
import Layout from '../layouts/Main.astro'; import Layout from '../layouts/Main.astro';
--- ---
<Layout centered content={{ title: 'Astro Documentation' }}> <Layout centered>
<h1> <h1>
<code style="white-space: nowrap;">npm init astro</code> <code style="white-space: nowrap;">npm init astro</code>
</h1> </h1>