From dafd68fcd289be62c8db6ac7df8e55b9771f92f7 Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Fri, 19 Aug 2022 15:52:57 +0300 Subject: [PATCH] feat: added canonical urls --- package.json | 2 +- src/components/ArticlePost/ArticlePost.astro | 2 +- src/components/BaseHead.astro | 9 +++-- .../ContactsList/ContactsList.astro | 20 +++++----- src/components/Footer/Footer.astro | 40 +++++++++---------- src/components/Header/Header.astro | 2 +- .../ProjectsList/ProjectsList.astro | 6 +-- src/components/SkillsList/SkillsList.astro | 4 +- src/layouts/article.astro | 5 ++- src/layouts/default.astro | 7 ++-- src/pages/blog/[...slug].astro | 3 +- src/templates/Articles.astro | 3 +- src/templates/Home.astro | 3 +- 13 files changed, 57 insertions(+), 49 deletions(-) diff --git a/package.json b/package.json index e30221c..7ff3e80 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "start": "astro dev", "build": "astro build", "preview": "astro preview --host", - "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json}\"", + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,astro}\"", "lint": "eslint '**/*.{js,mjs,ts,tsx}'" }, "devDependencies": { diff --git a/src/components/ArticlePost/ArticlePost.astro b/src/components/ArticlePost/ArticlePost.astro index d5afdda..c942b5d 100644 --- a/src/components/ArticlePost/ArticlePost.astro +++ b/src/components/ArticlePost/ArticlePost.astro @@ -39,7 +39,7 @@ const { title, coverImage, tags, author, published_at } = data; coverImage && (
- {coverImage && {title}} + {coverImage && {title}} {/* Render remote or local image */} {/* utils.isURL(coverImage) ? ( {data.title} diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index f679274..ce811b1 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -5,10 +5,11 @@ import { useTranslation } from "@i18n/utils"; export interface Props { title?: string | undefined; description?: string | undefined; + canonicalUrl?: string | undefined; } const t = useTranslation(Astro); -const { title = SITE_METADATA.title, description } = Astro.props as Props; +const { title = SITE_METADATA.title, description, canonicalUrl } = Astro.props as Props; --- @@ -16,9 +17,11 @@ const { title = SITE_METADATA.title, description } = Astro.props as Props; - + {canonicalUrl && } {title} diff --git a/src/components/ContactsList/ContactsList.astro b/src/components/ContactsList/ContactsList.astro index 3ab3f95..b3a3691 100644 --- a/src/components/ContactsList/ContactsList.astro +++ b/src/components/ContactsList/ContactsList.astro @@ -1,24 +1,24 @@ --- -import { SITE_METADATA } from '@root/config'; -import { Icon } from 'astro-icon'; -import './ContactsList.scss'; +import { SITE_METADATA } from "@root/config"; +import { Icon } from "astro-icon"; +import "./ContactsList.scss"; const { contacts: { email, githubUrl, telegramUrl }, } = SITE_METADATA; --- - diff --git a/src/components/Footer/Footer.astro b/src/components/Footer/Footer.astro index cfc3451..e1298aa 100644 --- a/src/components/Footer/Footer.astro +++ b/src/components/Footer/Footer.astro @@ -1,24 +1,24 @@ --- -import './Footer.scss'; -import { Icon } from 'astro-icon' +import "./Footer.scss"; +import { Icon } from "astro-icon"; --- -