fix: invalid canonicalization
This commit is contained in:
@ -21,7 +21,7 @@ const Helmet = (props) => (
|
|||||||
<meta name="keywords" content={ siteConfig.keywords.join(',') } />
|
<meta name="keywords" content={ siteConfig.keywords.join(',') } />
|
||||||
|
|
||||||
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, maximum-scale=3.0, minimum-scale=1.0" />
|
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0, maximum-scale=3.0, minimum-scale=1.0" />
|
||||||
<link rel="canonical" href={ siteConfig.url.web } />
|
{ props.canonical && <link rel="canonical" href={ props.canonical } /> }
|
||||||
<meta httpEquiv="Content-Language" content="en" />
|
<meta httpEquiv="Content-Language" content="en" />
|
||||||
|
|
||||||
<meta property="og:title" content={ prepareTitle(props.title) } />
|
<meta property="og:title" content={ prepareTitle(props.title) } />
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Helmet from 'components/helmet';
|
|
||||||
import './global.scss';
|
import './global.scss';
|
||||||
import { firePageView } from 'lib/gtag';
|
import { firePageView } from 'lib/gtag';
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
export const serverOnlyProps = (callback) => {
|
export const serverOnlyProps = (callback) => {
|
||||||
return async (props) => {
|
return async (props) => {
|
||||||
|
// noinspection JSUnresolvedVariable
|
||||||
if (process.browser) {
|
if (process.browser) {
|
||||||
// noinspection ES6ModulesDependencies,JSUnresolvedVariable
|
// noinspection ES6ModulesDependencies,JSUnresolvedVariable
|
||||||
return __NEXT_DATA__.props.pageProps;
|
return __NEXT_DATA__.props.pageProps;
|
||||||
|
@ -4,11 +4,12 @@ import SiteNav from 'components/site-nav';
|
|||||||
import PageFooter from 'components/page-footer';
|
import PageFooter from 'components/page-footer';
|
||||||
import { serverOnlyProps } from 'lib/server';
|
import { serverOnlyProps } from 'lib/server';
|
||||||
import { getRequestedRoadmap } from 'lib/roadmap';
|
import { getRequestedRoadmap } from 'lib/roadmap';
|
||||||
|
import siteConfig from 'storage/site';
|
||||||
import Helmet from 'components/helmet';
|
import Helmet from 'components/helmet';
|
||||||
import RoadmapSummary from 'components/roadmap-summary';
|
import RoadmapSummary from 'components/roadmap-summary';
|
||||||
import DetailedRoadmap from 'components/detailed-roadmap';
|
import DetailedRoadmap from 'components/detailed-roadmap';
|
||||||
|
|
||||||
const Roadmap = ({ roadmap }) => {
|
const Roadmap = ({ roadmap, canonical }) => {
|
||||||
if (!roadmap) {
|
if (!roadmap) {
|
||||||
return <Error statusCode={ 404 } />
|
return <Error statusCode={ 404 } />
|
||||||
}
|
}
|
||||||
@ -16,7 +17,11 @@ const Roadmap = ({ roadmap }) => {
|
|||||||
const showSummary = roadmap.upcoming || !roadmap.detailed;
|
const showSummary = roadmap.upcoming || !roadmap.detailed;
|
||||||
return (
|
return (
|
||||||
<DefaultLayout>
|
<DefaultLayout>
|
||||||
<Helmet title={ roadmap.title } description={ roadmap.description } />
|
<Helmet
|
||||||
|
canonical={canonical}
|
||||||
|
title={ roadmap.title }
|
||||||
|
description={ roadmap.description }
|
||||||
|
/>
|
||||||
<SiteNav />
|
<SiteNav />
|
||||||
{ showSummary ? <RoadmapSummary roadmap={roadmap} /> : <DetailedRoadmap roadmap={roadmap} /> }
|
{ showSummary ? <RoadmapSummary roadmap={roadmap} /> : <DetailedRoadmap roadmap={roadmap} /> }
|
||||||
<PageFooter />
|
<PageFooter />
|
||||||
@ -26,6 +31,7 @@ const Roadmap = ({ roadmap }) => {
|
|||||||
|
|
||||||
Roadmap.getInitialProps = serverOnlyProps(({ req }) => {
|
Roadmap.getInitialProps = serverOnlyProps(({ req }) => {
|
||||||
return {
|
return {
|
||||||
|
canonical: `${siteConfig.url.web}${req.url}`,
|
||||||
roadmap: getRequestedRoadmap(req),
|
roadmap: getRequestedRoadmap(req),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
@ -6,15 +6,20 @@ import GuideBody from 'components/guide-body';
|
|||||||
import GuideFooter from 'components/guide-footer';
|
import GuideFooter from 'components/guide-footer';
|
||||||
import { getRequestedGuide } from 'lib/guide';
|
import { getRequestedGuide } from 'lib/guide';
|
||||||
import Helmet from 'components/helmet';
|
import Helmet from 'components/helmet';
|
||||||
|
import siteConfig from 'storage/site';
|
||||||
|
|
||||||
const Guide = ({ guide }) => {
|
const Guide = ({ guide, canonical }) => {
|
||||||
if (!guide) {
|
if (!guide) {
|
||||||
return <Error statusCode={ 404 } />
|
return <Error statusCode={ 404 } />
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<GuideLayout>
|
<GuideLayout>
|
||||||
<Helmet title={ guide.title } description={ guide.description } />
|
<Helmet
|
||||||
|
title={ guide.title }
|
||||||
|
description={ guide.description }
|
||||||
|
canonical={ guide.canonical || canonical }
|
||||||
|
/>
|
||||||
<GuideHeader guide={ guide } />
|
<GuideHeader guide={ guide } />
|
||||||
<GuideBody guide={ guide } />
|
<GuideBody guide={ guide } />
|
||||||
<GuideFooter guide={ guide } />
|
<GuideFooter guide={ guide } />
|
||||||
@ -24,6 +29,7 @@ const Guide = ({ guide }) => {
|
|||||||
|
|
||||||
Guide.getInitialProps = serverOnlyProps(async ({ req }) => {
|
Guide.getInitialProps = serverOnlyProps(async ({ req }) => {
|
||||||
return {
|
return {
|
||||||
|
canonical: `${siteConfig.url.web}${req.url}`,
|
||||||
guide: await getRequestedGuide(req),
|
guide: await getRequestedGuide(req),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user