Skip to content

Commit

Permalink
feat: append site title to page title
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlatz committed Jan 17, 2025
1 parent 59ccb2e commit cdd0663
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/layouts/Base.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ export interface Props {
// distructure frontmatters
const { title, meta_title, description, image, noindex, canonical } =
Astro.props;
const titleFromProps = plainify(meta_title ? meta_title : title ? title : '');
const pageTitle = titleFromProps ? `${titleFromProps} · ${config.site.title}` : config.site.title;
---

<!doctype html>
Expand Down Expand Up @@ -100,7 +103,7 @@ const { title, meta_title, description, image, noindex, canonical } =

<!-- title -->
<title>
{plainify(meta_title ? meta_title : title ? title : config.site.title)}
{pageTitle}
</title>

<!-- canonical url -->
Expand Down

0 comments on commit cdd0663

Please sign in to comment.