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

Fix: Layout components to include canonical URLs #18

Merged
merged 2 commits into from
Sep 26, 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
3 changes: 2 additions & 1 deletion src/components/blog-page/Post.astro
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import Layout from "../../layouts/Layout.astro";
import "../../styles/blog.css";

const post = Astro.props.frontmatter ?? Astro.props;
const canonicalUrl = `https://novage.com.ua/blog/${post.slug}`;
---

<Layout title={post.title}>
<Layout title={post.title} canonical={canonicalUrl}>
<Header />
<div id="content">
<article>
Expand Down
5 changes: 4 additions & 1 deletion src/layouts/Layout.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import "../styles/main.css";

interface Props {
title: string;
canonical?: string;
}

const { title } = Astro.props;
const { title, canonical } = Astro.props;
---

<!doctype html>
Expand Down Expand Up @@ -47,6 +48,8 @@ const { title } = Astro.props;
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/>

{canonical && <link rel="canonical" href={canonical} />}

<script is:inline>
window.dataLayer = window.dataLayer || [];

Expand Down
4 changes: 2 additions & 2 deletions src/pages/blog/blog.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import Layout from "../../layouts/Layout.astro";
import "../../styles/blog.css";

const posts = (await getCollection("blog")).sort(
(a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf(),
(a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf()
);
---

<Layout title="Novage Blog">
<Layout title="Novage Blog" canonical="https://novage.com.ua/blog">
<Header />
<div id="content">
<article>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/blog/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import Layout from "../../layouts/Layout.astro";
import "../../styles/blog.css";

const posts = (await getCollection("blog")).sort(
(a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf(),
(a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf()
);
---

<Layout title="Novage Blog">
<Layout title="Novage Blog" canonical="https://novage.com.ua/blog">
<Header />
<div id="content">
<article>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Footer from "../components/shared/Footer.astro";
import PageHeader from "../components/shared/PageHeader.astro";
---

<Layout title="Novage">
<Layout title="Novage" canonical="https://novage.com.ua/">
<Header />
<div id="content">
<article>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/p2p-media-loader/demo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import { P2PVideoDemo } from "p2p-media-loader-demo";
href="/_astro/_astro-entry_p2p-media-loader-demo.BMEc0IOl.css"
/>

<Layout title="P2P Media Loader">
<Layout
title="P2P Media Loader"
canonical="https://novage.com.ua/p2p-media-loader/demo"
>
<Header />

<div id="content">
Expand Down
5 changes: 4 additions & 1 deletion src/pages/p2p-media-loader/overview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import Layout from "../../layouts/Layout.astro";
import img from "../../../public/images/p2p-assisted-media-delivery.png";
---

<Layout title="P2P Media Loader">
<Layout
title="P2P Media Loader"
canonical="https://novage.com.ua/p2p-media-loader/overview"
>
<Header />
<div id="content">
<article>
Expand Down
5 changes: 4 additions & 1 deletion src/pages/p2p-media-loader/technical-overview.astro
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import Layout from "../../layouts/Layout.astro";
import img from "../../../public/images/p2p-media-loader-network.png";
---

<Layout title="P2P Media Loader">
<Layout
title="P2P Media Loader"
canonical="https://novage.com.ua/p2p-media-loader/technical-overview"
>
<Header />
<div id="content">
<article>
Expand Down
Loading