Skip to content

Commit 0baead1

Browse files
authored
Add canonical links to pages, improve meta tags, etc. (th0th#175)
* Add canonical links to pages, improve meta tags, etc. * Update development.Dockerfile
1 parent 0443605 commit 0baead1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+240
-94
lines changed

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docker-compose.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,16 @@ services:
7878
context: frontend
7979
dockerfile: development.Dockerfile
8080
environment:
81-
FRONTEND_BASE_URL: ${FRONTEND_BASE_URL}
82-
FRONTEND_USE_POLLING: ${FRONTEND_USE_POLLING}
81+
NEXT_PUBLIC_BASE_URL: ${FRONTEND_BASE_URL}
8382
NEXT_PUBLIC_GOOGLE_CLIENT_ID: ${GOOGLE_CLIENT_ID}
8483
NEXT_PUBLIC_HOSTED: ${HOSTED}
84+
NEXT_PUBLIC_REST_API_BASE_URL: ${REST_API_BASE_URL}
8585
NEXT_PUBLIC_SENTRY_DSN: ${SENTRY_DSN}
8686
NEXT_PUBLIC_SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT}
8787
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY: ${STRIPE_PUBLISHABLE_KEY}
8888
NEXT_PUBLIC_WEBHOOK_URL: ${WEBHOOK_URL}
8989
NEXT_TELEMETRY_DISABLED: "1"
90-
REST_API_BASE_URL: ${REST_API_BASE_URL}
90+
USE_POLLING: ${FRONTEND_USE_POLLING}
9191
VIRTUAL_HOST: dev.poeticmetric.com
9292
VIRTUAL_PORT: "3000"
9393
image: ghcr.io/th0th/poeticmetric/frontend:development

frontend/@types/docs.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
type DocsArticle = {
22
category: Omit<DocsCategory, "articles">;
33
content: string;
4+
excerpt: string;
45
slug: string;
56
title: string;
67
};

frontend/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ RUN npm install --global [email protected]
66
ARG BASE_URL
77
ARG GOOGLE_CLIENT_ID
88
ARG HOSTED=false
9+
ARG REST_API_BASE_URL
910
ARG ROBOTS_TXT_ALLOW=false
1011
ARG SENTRY_AUTH_TOKEN
1112
ARG SENTRY_DSN
@@ -48,6 +49,7 @@ ENV NEXT_TELEMETRY_DISABLED=1
4849
ENV BASE_URL=${BASE_URL}
4950
ENV NEXT_PUBLIC_GOOGLE_CLIENT_ID=${GOOGLE_CLIENT_ID}
5051
ENV NEXT_PUBLIC_HOSTED=${HOSTED}
52+
ENV NEXT_PUBLIC_REST_API_BASE_URL=${REST_API_BASE_URL}
5153
ENV NEXT_PUBLIC_SENTRY_DSN=${SENTRY_DSN}
5254
ENV NEXT_PUBLIC_SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}
5355
ENV NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=${STRIPE_PUBLISHABLE_KEY}

frontend/components/BlogPage/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { range } from "lodash";
33
import Link from "next/link";
44
import React, { useMemo } from "react";
55
import { Col, Container, Pagination, Row } from "react-bootstrap";
6+
import { CanonicalLink } from "../CanonicalLink";
67
import { Description } from "../Description";
78
import { Layout } from "../Layout";
89
import { Title } from "../Title";
@@ -50,7 +51,10 @@ export function BlogPage({ currentPage, pageCount, posts }: BlogPageProps) {
5051

5152
return (
5253
<Layout kind="website">
54+
<CanonicalLink path={currentPage === 1 ? "/blog" : `/blog/page/${currentPage}`} />
55+
5356
<Title kind="blog">Privacy-focused web analytics tips and best practices</Title>
57+
5458
<Description>
5559
Stay up to date on the latest privacy-first and regulation-compliant web analytics news, tips, and best practices with
5660
PoeticMetric&apos;s blog. Learn how to use data to improve your website and better understand your users, all while keeping their

frontend/components/BlogPost/index.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import Link from "next/link";
22
import React, { useMemo } from "react";
33
import { Container } from "react-bootstrap";
4+
import { CanonicalLink } from "../CanonicalLink";
45
import { Description } from "../Description";
56
import { Layout } from "../Layout";
67
import { Markdown } from "../Markdown";
@@ -43,7 +44,10 @@ export function BlogPost({ nextPost, post, previousPost }: BlogPostProps) {
4344

4445
return (
4546
<Layout kind="website">
47+
<CanonicalLink path={`/blog/${post.slug}`} />
48+
4649
<Title kind="blog">{post.title}</Title>
50+
4751
<Description>{post.excerpt}</Description>
4852

4953
<Container className="pt-4">

frontend/components/Bootstrap/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Alert, Button, Card, Container, Form, Spinner } from "react-bootstrap";
44
import { AuthContext, ToastsContext } from "../../contexts";
55
import { api, setUserAccessToken } from "../../helpers";
66
import { useForm } from "../../hooks";
7+
import { Title } from "../Title";
78

89
type Form = {
910
createDemoSite: boolean;
@@ -93,11 +94,13 @@ export function Bootstrap() {
9394

9495
return state.isReady ? (
9596
<Container className="py-5">
97+
<Title>Complete PoeticMetric installation</Title>
98+
9699
<div className="text-center">
97100
<h1>Welcome to PoeticMetric!</h1>
98101

99102
<div className="mt-3">
100-
Initialize your PoeticMetric installation to continue.
103+
Complete PoeticMetric installation to continue.
101104
</div>
102105
</div>
103106

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import Head from "next/head";
2+
import React from "react";
3+
import { getUrl } from "../../helpers";
4+
5+
export type CanonicalLinkProps = {
6+
path: string;
7+
};
8+
9+
export function CanonicalLink({ path }: CanonicalLinkProps) {
10+
return (
11+
<Head>
12+
<link href={getUrl(path)} rel="canonical" />
13+
</Head>
14+
);
15+
}

frontend/components/DocsArticle/index.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1+
import { useRouter } from "next/router";
12
import React from "react";
2-
import { Breadcrumb } from "../Breadcrumb";
3-
import { Layout } from "../Layout";
4-
import { Markdown } from "../Markdown";
5-
import { Title } from "../Title";
3+
import { Breadcrumb, CanonicalLink, Description, Layout, Markdown, Title } from "..";
64
import { Menu } from "./Menu";
75

86
type DocsArticleProps = {
@@ -11,10 +9,20 @@ type DocsArticleProps = {
119
};
1210

1311
export function DocsArticle({ article, categories }: DocsArticleProps) {
12+
const router = useRouter();
13+
1414
return (
1515
<Layout kind="website">
16+
<CanonicalLink
17+
path={router.asPath === "/docs"
18+
? `/docs/${categories[0].slug}/${categories[0].articles[0].slug}`
19+
: `/docs/${article.category.slug}/${article.slug}`}
20+
/>
21+
1622
<Title kind="docs">{article.title}</Title>
1723

24+
<Description>{article.excerpt}</Description>
25+
1826
<div className="bg-white d-flex flex-column flex-grow-1 flex-md-row">
1927
<Menu article={article} categories={categories} />
2028

frontend/components/Home/index.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { CallToAction, Description, Features, FeaturesProps, Layout, Title } from "..";
2+
import { CallToAction, CanonicalLink, Description, Features, FeaturesProps, Layout, Title } from "..";
33
import { Jumbotron } from "./Jumbotron";
44
import { Preview } from "./Preview";
55

@@ -48,7 +48,10 @@ const features: FeaturesProps["features"] = [
4848
export function Home() {
4949
return (
5050
<Layout kind="website">
51-
<Title>Privacy-first, regulation compliant Google Analytics alternative</Title>
51+
<CanonicalLink path="" />
52+
53+
<Title>Free and open source, privacy-friendly Google Analytics alternative</Title>
54+
5255
<Description>
5356
PoeticMetric is a free as in freedom, open source, privacy-first and regulation-compliant web analytics tool. You can keep track of
5457
your website&apos;s traffic without invading your visitors&apos; privacy.

0 commit comments

Comments
 (0)