fix canonical urls

This commit is contained in:
Aarni Halinen
2021-03-28 22:20:55 +03:00
parent 89a40d4757
commit 9777d30b38
23 changed files with 107 additions and 160 deletions
-1
View File
@@ -16,7 +16,6 @@ const NotFound = styled.main`
const NotFoundPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/404" />
<title>404 | Ei vaan löydy</title>
<meta name="robots" content="noindex" />
</Head>
+12 -18
View File
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { NextPage } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
import Tag from "@models/Tag";
@@ -238,23 +237,18 @@ const EventCreatePage: NextPage = () => {
: "Create Event";
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/admin/events/create" />
</Head>
<AdminCreateCommon
title={title}
formData={formData}
schema={buildSchema(formData, signupForms, tags)}
UISchema={buildUISchema()}
onChange={onChange}
onFocus={onFocus}
onSubmit={onSubmit}
statusMessage={statusMessage}
error={error}
widgets={widgets}
/>
</>
<AdminCreateCommon
title={title}
formData={formData}
schema={buildSchema(formData, signupForms, tags)}
UISchema={buildUISchema()}
onChange={onChange}
onFocus={onFocus}
onSubmit={onSubmit}
statusMessage={statusMessage}
error={error}
widgets={widgets}
/>
);
};
+5 -11
View File
@@ -1,6 +1,5 @@
import React from "react";
import { NextPage } from "next";
import Head from "next/head";
import { formatRelative } from "date-fns";
import AdminListCommon from "@views/admin/AdminListCommon";
import { Link } from "@components/index";
@@ -39,16 +38,11 @@ const renderData = (events: Event[]) => {
const AdminEventPage: NextPage = () => {
const { data } = useFetchEvents({ options: { auth: true } });
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/${URL}`} />
</Head>
<AdminListCommon>
<h1>Events</h1>
<AddLink text="Create event" to={`${URL}/create`} data-e2e="create-event" />
{renderData(data)}
</AdminListCommon>
</>
<AdminListCommon>
<h1>Events</h1>
<AddLink text="Create event" to={`${URL}/create`} data-e2e="create-event" />
{renderData(data)}
</AdminListCommon>
);
};
+12 -18
View File
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { NextPage } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
import Tag from "@models/Tag";
@@ -189,23 +188,18 @@ const FeedCreatePage: NextPage = () => {
: "Create Post";
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/admin/feed/create" />
</Head>
<AdminCreateCommon
title={title}
formData={formData}
schema={buildSchema(formData, tags)}
UISchema={buildUISchema(formData)}
onChange={onChange}
onFocus={onFocus}
onSubmit={onSubmit}
statusMessage={statusMessage}
error={error}
widgets={widgets}
/>
</>
<AdminCreateCommon
title={title}
formData={formData}
schema={buildSchema(formData, tags)}
UISchema={buildUISchema(formData)}
onChange={onChange}
onFocus={onFocus}
onSubmit={onSubmit}
statusMessage={statusMessage}
error={error}
widgets={widgets}
/>
);
};
+5 -11
View File
@@ -1,6 +1,5 @@
import React from "react";
import { NextPage } from "next";
import Head from "next/head";
import { formatRelative } from "date-fns";
import AdminListCommon from "@views/admin/AdminListCommon";
import { Link } from "@components/index";
@@ -40,16 +39,11 @@ const renderData = (feed: Post[]) => {
const AdminFeedPage: NextPage = () => {
const { data } = useFetchFeed({ options: { auth: true } });
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/${URL}`} />
</Head>
<AdminListCommon>
<h1>Feed</h1>
<AddLink text="Create news post" to={`${URL}/create`} />
{renderData(data)}
</AdminListCommon>
</>
<AdminListCommon>
<h1>Feed</h1>
<AddLink text="Create news post" to={`${URL}/create`} />
{renderData(data)}
</AdminListCommon>
);
};
+1 -1
View File
@@ -6,7 +6,7 @@ import AdminPageWrapper from "@views/common/AdminPageWrapper";
const AdminFrontPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/admin" />
<link rel="canonical" href={`${process.env.SITE_URL}/admin`} />
</Head>
<AdminPageWrapper requiresAuthentication>
<div data-e2e="admin-front-page">
+12 -18
View File
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { NextPage } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
import JobAd from "@models/JobAd";
@@ -153,23 +152,18 @@ const JobAdCreatePage: NextPage = () => {
: "Create Ad";
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/admin/jobads/create" />
</Head>
<AdminCreateCommon
title={title}
formData={formData}
schema={buildSchema(formData)}
UISchema={buildUISchema(formData)}
onChange={onChange}
onFocus={onFocus}
onSubmit={onSubmit}
statusMessage={statusMessage}
error={error}
widgets={widgets}
/>
</>
<AdminCreateCommon
title={title}
formData={formData}
schema={buildSchema(formData)}
UISchema={buildUISchema(formData)}
onChange={onChange}
onFocus={onFocus}
onSubmit={onSubmit}
statusMessage={statusMessage}
error={error}
widgets={widgets}
/>
);
};
+5 -11
View File
@@ -1,6 +1,5 @@
import React from "react";
import { NextPage } from "next";
import Head from "next/head";
import { formatRelative } from "date-fns";
import AdminListCommon from "@views/admin/AdminListCommon";
import { Link } from "@components/index";
@@ -44,16 +43,11 @@ const renderData = (jobAds: JobAd[]) => {
const AdminJobAdPage: NextPage = () => {
const { data } = useFetchJobAds({ options: { auth: true } });
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/${URL}`} />
</Head>
<AdminListCommon>
<h1>Job advertisements</h1>
<AddLink text="Create job ad" to={`${URL}/create`} />
{renderData(data)}
</AdminListCommon>
</>
<AdminListCommon>
<h1>Job advertisements</h1>
<AddLink text="Create job ad" to={`${URL}/create`} />
{renderData(data)}
</AdminListCommon>
);
};
+38 -44
View File
@@ -1,6 +1,5 @@
import React, { useState, useEffect } from "react";
import { NextPage } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import styled from "styled-components";
import { generateToken, setTokenCookie, isAuthenticated } from "@utils/auth";
@@ -40,49 +39,44 @@ const AdminLoginPage: NextPage = () => {
};
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/admin/login" />
</Head>
<AdminPageWrapper requiresAuthentication={false}>
<Main>
<h1>Log in to SIK Admin</h1>
{next && next !== DEFAULT_REDIRECT && (
<div className="error">You have to log in first.</div>
)}
<form className="admin-login-form" onSubmit={handleSubmit}>
<label>Username
<input
id="login-username"
type="text"
name="username"
value={username}
onChange={(e) => {
setUsername(e.target.value);
}}
/>
</label>
<label>Password
<input
id="login-password"
type="password"
name="password"
value={password}
onChange={(e) => {
setPassword(e.target.value);
}}
/>
</label>
<input id="login-submit" type="submit" value="Log in" />
</form>
{error && (
<div className="error">
{error}
</div>
)}
</Main>
</AdminPageWrapper>
</>
<AdminPageWrapper requiresAuthentication={false}>
<Main>
<h1>Log in to SIK Admin</h1>
{next && next !== DEFAULT_REDIRECT && (
<div className="error">You have to log in first.</div>
)}
<form className="admin-login-form" onSubmit={handleSubmit}>
<label>Username
<input
id="login-username"
type="text"
name="username"
value={username}
onChange={(e) => {
setUsername(e.target.value);
}}
/>
</label>
<label>Password
<input
id="login-password"
type="password"
name="password"
value={password}
onChange={(e) => {
setPassword(e.target.value);
}}
/>
</label>
<input id="login-submit" type="submit" value="Log in" />
</form>
{error && (
<div className="error">
{error}
</div>
)}
</Main>
</AdminPageWrapper>
);
};
-4
View File
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { NextPage } from "next";
import Head from "next/head";
import { useRouter } from "next/router";
import AdminCreateCommon from "@views/admin/AdminCreateCommon";
import { SignupForm } from "@models/Signup";
@@ -161,9 +160,6 @@ const SignupCreatePage: NextPage = () => {
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/admin/signups/create" />
</Head>
<AdminCreateCommon
title={title}
formData={formData}
+5 -11
View File
@@ -1,6 +1,5 @@
import React, { useEffect, useState } from "react";
import { NextPage } from "next";
import Head from "next/head";
import { formatRelative } from "date-fns";
import AdminListCommon from "@views/admin/AdminListCommon";
import { Link } from "@components/index";
@@ -50,16 +49,11 @@ const AdminSignupPage: NextPage = () => {
}, []);
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/${URL}`} />
</Head>
<AdminListCommon>
<h1>Sign-up forms</h1>
<AddLink text="Create signup form" to={`${URL}/create`} data-e2e="create-signup" />
{renderData(forms)}
</AdminListCommon>
</>
<AdminListCommon>
<h1>Sign-up forms</h1>
<AddLink text="Create signup form" to={`${URL}/create`} data-e2e="create-signup" />
{renderData(forms)}
</AdminListCommon>
);
};
+1 -1
View File
@@ -25,7 +25,7 @@ const EventPage: NextPage<InitialProps> = ({ initialEvent }) => {
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/events/${id}`} />
<link rel="canonical" href={`${process.env.SITE_URL}/events/${id}`} />
</Head>
<PageWrapper>
<EventPageView event={data as Event} />
+1 -1
View File
@@ -25,7 +25,7 @@ const FeedPage: NextPage<InitialProps> = ({ initialPost }) => {
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/events/${id}`} />
<link rel="canonical" href={`${process.env.SITE_URL}/feed/${id}`} />
</Head>
<PageWrapper>
<FeedPageView post={data} />
+1 -1
View File
@@ -27,7 +27,7 @@ const InEnglishPage: NextPage<InitialProps> = ({ initialEvents, initialFeed }) =
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/in_english" />
<link rel="canonical" href={`${process.env.SITE_URL}/in_english`} />
</Head>
<PageWrapper>
<InEnglishPageView events={eventResult.data as Event[]} feed={feedResult.data} />
+1 -1
View File
@@ -27,7 +27,7 @@ const FrontPage: NextPage<InitialProps> = ({ initialEvents, initialFeed }) => {
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/" />
<link rel="canonical" href={`${process.env.SITE_URL}/`} />
</Head>
<PageWrapper>
<FrontPageView events={eventResult.data as Event[]} feed={feedResult.data} />
+1 -1
View File
@@ -7,7 +7,7 @@ import PageWrapper from "@views/common/PageWrapper";
const FreshmenPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/kilta/fuksit" />
<link rel="canonical" href={`${process.env.SITE_URL}/kilta/fuksi`} />
</Head>
<PageWrapper>
<FreshmenPageView />
+1 -1
View File
@@ -7,7 +7,7 @@ import PageWrapper from "@views/common/PageWrapper";
const GuildPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/kilta" />
<link rel="canonical" href={`${process.env.SITE_URL}/kilta`} />
</Head>
<PageWrapper>
<GuildPageView />
+1 -1
View File
@@ -7,7 +7,7 @@ import PageWrapper from "@views/common/PageWrapper";
const HonoraryPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/kilta/kunnia" />
<link rel="canonical" href={`${process.env.SITE_URL}/kilta/kunnia`} />
</Head>
<PageWrapper>
<HonoraryPageView />
+1 -1
View File
@@ -26,7 +26,7 @@ const ActualPage: NextPage<InitialProps> = ({ initialEvents, initialFeed }) => {
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/kilta/toiminta" />
<link rel="canonical" href={`${process.env.SITE_URL}/kilta/toiminta`} />
</Head>
<PageWrapper>
<ActualPageView events={eventResult.data} feed={feedResult.data} />
+1 -1
View File
@@ -7,7 +7,7 @@ import PageWrapper from "@views/common/PageWrapper";
const StudiesPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/opinnot_ja_ura" />
<link rel="canonical" href={`${process.env.SITE_URL}/opinnot_ja_ura`} />
</Head>
<PageWrapper>
<StudiesPageView />
+1 -1
View File
@@ -40,7 +40,7 @@ const SignUpPage: NextPage<InitialProps> = ({ form }) => {
return (
<>
<Head>
<link rel="canonical" href={`https://sik.ayy.fi/signup/${form.id}`} />
<link rel="canonical" href={`${process.env.SITE_URL}/signup/${form.id}`} />
</Head>
<PageWrapper>
<SignUpPageView
+1 -1
View File
@@ -7,7 +7,7 @@ import PageWrapper from "@views/common/PageWrapper";
const ContactsPage: NextPage = () => (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/yhteystiedot" />
<link rel="canonical" href={`${process.env.SITE_URL}/yhteystiedot`} />
</Head>
<PageWrapper>
<ContactsPageView />
+1 -1
View File
@@ -17,7 +17,7 @@ const CorporatePage: NextPage<InitialProps> = ({ initialJobAds }) => {
return (
<>
<Head>
<link rel="canonical" href="https://sik.ayy.fi/yritysyhteistyo" />
<link rel="canonical" href={`${process.env.SITE_URL}/yritysyhteistyo`} />
</Head>
<PageWrapper>
<CorporatePageView jobAds={data as JobAd[]} />