Skip to content

Commit 9c8ab14

Browse files
rseseemilyistoofunkyjaniceileneheiskr
authored
Set meta description on homepage (#25546)
* Set meta description on homepage * Update data/ui.yml Co-authored-by: Janice <janiceilene@github.com> * Better naming Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> * Update string key * Always rendered Co-authored-by: Emily Gould <4822039+emilyistoofunky@users.noreply.github.com> Co-authored-by: Janice <janiceilene@github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com>
1 parent 7f898c3 commit 9c8ab14

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

components/DefaultLayout.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ export const DefaultLayout = (props: Props) => {
2424
fullUrl,
2525
status,
2626
} = useMainContext()
27-
const { t } = useTranslation(['errors', 'scroll_button'])
27+
const { t } = useTranslation(['errors', 'meta', 'scroll_button'])
2828
const router = useRouter()
29+
const metaDescription = page.introPlainText ? page.introPlainText : t('default_description')
2930
return (
3031
<div className="d-lg-flex">
3132
<Head>
@@ -37,7 +38,7 @@ export const DefaultLayout = (props: Props) => {
3738
) : null}
3839

3940
{/* For Google and Bots */}
40-
{page.introPlainText && <meta name="description" content={page.introPlainText} />}
41+
<meta name="description" content={metaDescription} />
4142
{page.hidden && <meta name="robots" content="noindex" />}
4243
{page.languageVariants.map((languageVariant) => {
4344
return (

data/ui.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
meta:
2+
default_description: Get started, troubleshoot, and make the most of GitHub. Documentation for new users, developers, administrators, and all of GitHub's products.
13
header:
24
github_docs: GitHub Docs
35
contact: Contact

0 commit comments

Comments
 (0)