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

feat: seo #29

Merged
merged 6 commits into from
Sep 4, 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: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# seo/public
**/sitemap*.xml
2 changes: 1 addition & 1 deletion knip.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { KnipConfig } from "knip";

const config = {
ignore: ["src/components/ui/**"],
ignore: ["src/components/ui/**", "next-sitemap.config.js"],
// sharp is used in nextjs image optimization
ignoreDependencies: ["sharp", "@radix-ui/*"],
} satisfies KnipConfig;
Expand Down
4 changes: 4 additions & 0 deletions next-sitemap.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
siteUrl: "https://planer.solvro.pl",
generateRobotsTxt: true,
};
41 changes: 40 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"scripts": {
"dev": "next dev",
"build": "next build",
"postbuild": "next-sitemap",
"start": "next start",
"lint": "next lint",
"lint:fix": "next lint --fix",
Expand All @@ -29,6 +30,7 @@
"jotai": "^2.9.3",
"lucide-react": "^0.426.0",
"next": "14.2.3",
"next-sitemap": "^4.2.3",
"oauth-1.0a": "^2.2.6",
"react": "^18",
"react-dom": "^18",
Expand Down
Binary file added public/android-chrome-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/android-chrome-512x512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/apple-touch-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/browserconfig.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>
Binary file added public/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/mstile-150x150.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/og_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# *
User-agent: *
Allow: /

# Host
Host: https://planer.solvro.pl

# Sitemaps
Sitemap: https://planer.solvro.pl/sitemap.xml
95 changes: 95 additions & 0 deletions public/safari-pinned-tab.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions public/site.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "Planer",
"short_name": "Planer",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
68 changes: 68 additions & 0 deletions src/components/SEO.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import Head from "next/head";
import React from "react";

export const Seo = ({
pageTitle,
pageDescription,
pageImage,
pageUrl,
}: {
pageTitle?: string;
pageDescription?: string;
pageImage?: string;
pageUrl?: string;
}) => (
<Head>
<title>
{typeof pageTitle === "string"
? `${pageTitle}`
: `Planer - utwórz swój plan zajęć na PWR!`}
</title>
<meta httpEquiv="x-ua-compatible" content="ie=edge" />
<meta
name="description"
content={
pageDescription ??
"Planer to strona stworzona z myślą o studentach PWR, którzy pragną w prosty i intuicyjny sposób zarządzać swoimi zapisami na kursy (za darmo!)."
}
/>
<meta name="robots" content="index, follow" />
<meta
name="keywords"
content="planer, zapisy, zapisynapwr, zapisownik, usos, nauka, Solvro, pwr, wrocław, politechnika"
/>

<meta
property="og:title"
content={pageTitle ?? "Planer - utwórz swój plan zajęć na PWR!"}
/>
<meta
property="og:description"
content={
pageDescription ??
"Planer to strona stworzona z myślą o studentach PWR, którzy pragną w prosty i intuicyjny sposób zarządzać swoimi zapisami na kursy (za darmo!)."
}
/>
<meta property="og:image" content={pageImage ?? "/og_image.png"} />
<meta property="og:url" content={pageUrl ?? "https://planer.solvro.pl/"} />
<meta property="og:type" content="website" />

<meta name="twitter:card" content="summary_large_image" />
<meta
name="twitter:title"
content="Planer - utwórz swój plan zajęć na PWR!"
/>
<meta name="twitter:description" content="https://planer.solvro.pl/" />
<meta name="twitter:image" content="/og_image.png" />

<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />

<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
<link rel="canonical" href="https://planer.solvro.pl/" />
</Head>
);
8 changes: 8 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import type { AppProps } from "next/app";
import { Space_Grotesk } from "next/font/google";
import Head from "next/head";
import Script from "next/script";

import { Seo } from "@/components/SEO";
import { cn } from "@/lib/utils";
import "@/styles/globals.css";
import type { UmamiTracker } from "@/types/umami";
Expand All @@ -20,6 +22,12 @@ declare global {
export default function App({ Component, pageProps }: AppProps) {
return (
<QueryClientProvider client={queryClient}>
<Head>
<meta charSet="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" href="/favicon.ico" />
</Head>
<Seo />
<Script
defer={true}
src="https://analytics.solvro.pl/script.js"
Expand Down
Loading
Loading