mirror of
https://github.com/sergeyyarkov/devthread.ru.git
synced 2026-10-11 10:19:13 +03:00
amp fixes
This commit is contained in:
parent
616945a627
commit
0d79c02440
@ -31,7 +31,7 @@ export const shouldUpdateScroll = ({ routerProps: { location } }) => {
|
||||
|
||||
export const wrapPageElement = ({ element, props }) => {
|
||||
const { location: { pathname } } = props
|
||||
pathname.includes('/amp/') ? props.amp = true : props.amp = false
|
||||
pathname.match(/article\/.*\/amp/) !== null ? props.amp = true : props.amp = false
|
||||
|
||||
return <Layout {...props}>{element}</Layout>
|
||||
}
|
||||
|
||||
@ -39,13 +39,17 @@ const OnDark = () => {
|
||||
)
|
||||
}
|
||||
|
||||
export const onRenderBody = ({ setPreBodyComponents }) => {
|
||||
export const onRenderBody = ({ pathname, setPreBodyComponents }) => {
|
||||
if (pathname.match(/article\/.*\/amp/) !== null) {
|
||||
return
|
||||
}
|
||||
|
||||
setPreBodyComponents(<OnDark key="isDarkTheme" />)
|
||||
}
|
||||
|
||||
export const wrapPageElement = ({ element, props }) => {
|
||||
const { location: { pathname } } = props
|
||||
pathname.includes('/amp/') ? props.amp = true : props.amp = false
|
||||
pathname.match(/article\/.*\/amp/) !== null ? props.amp = true : props.amp = false
|
||||
|
||||
return <Layout {...props}>{element}</Layout>
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user