diff options
author | Valentin Popov <valentin@popov.link> | 2024-09-13 01:57:55 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-09-13 01:57:55 +0300 |
commit | 33c9464dad0979b05323e4d508875ad47e1c425f (patch) | |
tree | 2bc986dbbb0278250ec6c48c4a1dae43ea20bd08 /src/components | |
parent | b16d8ce36ce5c603a4444979c30998416c416929 (diff) | |
download | popov.link-33c9464dad0979b05323e4d508875ad47e1c425f.tar.xz popov.link-33c9464dad0979b05323e4d508875ad47e1c425f.zip |
Refactor Analytics and Head components
Diffstat (limited to 'src/components')
-rw-r--r-- | src/components/Analytics.astro | 16 | ||||
-rw-r--r-- | src/components/Head.astro | 10 | ||||
-rw-r--r-- | src/components/Pagination.astro | 4 |
3 files changed, 21 insertions, 9 deletions
diff --git a/src/components/Analytics.astro b/src/components/Analytics.astro index 8c4303a..977c610 100644 --- a/src/components/Analytics.astro +++ b/src/components/Analytics.astro @@ -1,5 +1,17 @@ --- -const id = "T5X0z12SoASBV8Dv"; +type Props = { + readonly title: string; +}; + +const path = Astro.url.pathname; +const { title } = Astro.props; --- -<script is:inline src={`https://appmetrix.com/pixel/${id}`}></script> +<!-- AppMetrix --> +<script is:inline src="https://appmetrix.com/pixel/T5X0z12SoASBV8Dv"></script> + +<!-- GoatCounter --> +<script is:inline data-goatcounter="https://analytics.popov.link/count" src="//gc.zgo.at/count.js"></script> +<noscript> + <img alt="pixel" src={`https://analytics.popov.link/count?p=${path}&t=${title}`} /> +</noscript> diff --git a/src/components/Head.astro b/src/components/Head.astro index 7a575a9..9d7f39c 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -1,18 +1,18 @@ --- type Props = { - readonly description?: string; - readonly title?: string; + readonly description: string; + readonly title: string; }; const canonicalURL = new URL(Astro.url.pathname, Astro.site); -const { title, description } = Astro.props; +const { description, title } = Astro.props; --- <head> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> - <meta name="description" content={description ?? import.meta.env.DEFAULT_DESCRIPTION} /> + <meta name="description" content={description} /> <meta name="robots" content="index, follow" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> @@ -20,5 +20,5 @@ const { title, description } = Astro.props; <link href="/sitemap-index.xml" rel="sitemap" /> <link href={canonicalURL} rel="canonical" /> - <title>{title ?? import.meta.env.DEFAULT_TITLE}</title> + <title>{title}</title> </head> diff --git a/src/components/Pagination.astro b/src/components/Pagination.astro index cc85db7..835ea2d 100644 --- a/src/components/Pagination.astro +++ b/src/components/Pagination.astro @@ -3,11 +3,11 @@ import Next from "./Pagination/Next.astro"; import Prev from "./Pagination/Prev.astro"; type Props = { - readonly prevUrl?: string; readonly nextUrl?: string; + readonly prevUrl?: string; }; -const { prevUrl, nextUrl } = Astro.props; +const { nextUrl, prevUrl } = Astro.props; --- <style lang="scss"> |