mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 18:29:10 +03:00
fixed amp path
This commit is contained in:
parent
0d79c02440
commit
69a95f70a2
@ -31,7 +31,7 @@ export const shouldUpdateScroll = ({ routerProps: { location } }) => {
|
|||||||
|
|
||||||
export const wrapPageElement = ({ element, props }) => {
|
export const wrapPageElement = ({ element, props }) => {
|
||||||
const { location: { pathname } } = props
|
const { location: { pathname } } = props
|
||||||
pathname.match(/article\/.*\/amp/) !== null ? props.amp = true : props.amp = false
|
pathname.includes('/amp/article/') && props.pageContext.slug ? props.amp = true : props.amp = false
|
||||||
|
|
||||||
return <Layout {...props}>{element}</Layout>
|
return <Layout {...props}>{element}</Layout>
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,7 +148,7 @@ module.exports = {
|
|||||||
components: ['amp-sidebar', 'amp-accordion', 'amp-form'],
|
components: ['amp-sidebar', 'amp-accordion', 'amp-form'],
|
||||||
excludedPaths: ['/404*', '/'],
|
excludedPaths: ['/404*', '/'],
|
||||||
pathIdentifier: '/amp/',
|
pathIdentifier: '/amp/',
|
||||||
relAmpHtmlPattern: '{{canonicalBaseUrl}}{{pathname}}{{pathIdentifier}}',
|
relAmpHtmlPattern: '{{canonicalBaseUrl}}{{pathIdentifier}}{{pathname}}',
|
||||||
relCanonicalPattern: '{{canonicalBaseUrl}}{{pathname}}/',
|
relCanonicalPattern: '{{canonicalBaseUrl}}{{pathname}}/',
|
||||||
useAmpClientIdApi: false,
|
useAmpClientIdApi: false,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -55,7 +55,7 @@ exports.createPages = async ({ actions, graphql }) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
createPage({
|
createPage({
|
||||||
path: `article/${node.frontmatter.slug}/amp/`,
|
path: `amp/article/${node.frontmatter.slug}/`,
|
||||||
component: articleTemplateAMP,
|
component: articleTemplateAMP,
|
||||||
context: {
|
context: {
|
||||||
slug: node.frontmatter.slug,
|
slug: node.frontmatter.slug,
|
||||||
|
|||||||
@ -40,7 +40,7 @@ const OnDark = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const onRenderBody = ({ pathname, setPreBodyComponents }) => {
|
export const onRenderBody = ({ pathname, setPreBodyComponents }) => {
|
||||||
if (pathname.match(/article\/.*\/amp/) !== null) {
|
if (pathname.includes('/amp/article/')) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ export const onRenderBody = ({ pathname, setPreBodyComponents }) => {
|
|||||||
|
|
||||||
export const wrapPageElement = ({ element, props }) => {
|
export const wrapPageElement = ({ element, props }) => {
|
||||||
const { location: { pathname } } = props
|
const { location: { pathname } } = props
|
||||||
pathname.match(/article\/.*\/amp/) !== null ? props.amp = true : props.amp = false
|
pathname.includes('/amp/article/') && props.pageContext.slug ? props.amp = true : props.amp = false
|
||||||
|
|
||||||
return <Layout {...props}>{element}</Layout>
|
return <Layout {...props}>{element}</Layout>
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user