Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding canonical url to fix google indexing issue #165

Merged
merged 1 commit into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export default defineConfig({
inlineStylesheets: 'always',
assets: 'assets/docs/_astro'
},

site: 'https://noop.dev',
integrations: [tailwind(), mdx(), pagefind({site: 'dist', outputSubdir: 'assets/docs/pf'})]
})
4 changes: 3 additions & 1 deletion src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export interface Props {
title: string;
}

const canonicalURL = new URL(Astro.url.pathname, Astro.site);

const { data = {} } = Astro.props
---

Expand All @@ -22,7 +24,7 @@ const { data = {} } = Astro.props
<link rel="stylesheet" type="text/css" href="/assets/docs/styles.css" />
<meta name="robots" content="index, follow">
<meta name="description" content={data.description} />

<link rel="canonical" href={canonicalURL} />
<meta property="og:title" content={`Noop Developer Docs: ${data.title}`}>
<meta property="og:description" content={data.description}>
<meta property="og:url" content={Astro.url.pathname}>
Expand Down
Loading