@@ -7,6 +7,7 @@ import { getEntry } from "astro:content";
77import { getOgImage } from " ~/util/og" ;
88import type { CollectionEntry } from " astro:content" ;
99
10+ const DEFAULT_TITLE_DELIMITER = " |" ;
1011const NOINDEX_PRODUCTS = [" email-security" , " style-guide" , " security" ];
1112
1213const currentSection = Astro .url .pathname .split (" /" )[1 ].replaceAll (" ." , " " );
@@ -31,7 +32,9 @@ if (currentSection) {
3132 let title: string ;
3233
3334 if (titleIdx !== - 1 ) {
34- const existingTitle = head [titleIdx ].content ;
35+ const existingTitle = head [titleIdx ].content ?.split (
36+ ` ${DEFAULT_TITLE_DELIMITER } ` ,
37+ )[0 ];
3538 title = ` ${existingTitle } · ${product .data .meta .title } ` ;
3639
3740 head [titleIdx ] = {
@@ -80,6 +83,26 @@ if (shouldNoIndex) {
8083 });
8184}
8285
86+ if (
87+ frontmatter .description &&
88+ head .findIndex (
89+ ({ tag , attrs }) => tag === " meta" && attrs ?.name === " description" ,
90+ ) === - 1
91+ ) {
92+ const existingOpenGraphTag = head .findIndex (
93+ ({ tag , attrs }) => tag === " meta" && attrs ?.property === " og:description" ,
94+ );
95+
96+ if (existingOpenGraphTag !== - 1 ) {
97+ head [existingOpenGraphTag ].attrs ! .content = frontmatter .description ;
98+ }
99+
100+ metaTags .push ({
101+ name: " description" ,
102+ content: frontmatter .description as string ,
103+ });
104+ }
105+
83106if (frontmatter .pcx_content_type ) {
84107 [" pcx_content_type" , " algolia_content_type" ].map ((name ) => {
85108 metaTags .push ({
0 commit comments