{title}
@@ -111,9 +111,6 @@ const Footer = () => {
export default Footer
Footer.propTypes = {
- title: PropTypes.string,
+ amp: PropTypes.bool,
}
-Footer.defaultProps = {
- title: null,
-}
diff --git a/src/components/Header/Header.scss b/src/components/Header/Header.scss
index 39bd64a..70fb4d8 100644
--- a/src/components/Header/Header.scss
+++ b/src/components/Header/Header.scss
@@ -26,6 +26,9 @@ header {
padding: 0px 15px;
margin: 0 auto;
height: 100%;
+ &.amp {
+ max-width: 800px;
+ }
&__logo {
display: flex;
align-items: center;
@@ -353,6 +356,11 @@ header {
&__button.mobile {
display: none;
}
+ &.amp {
+ & .header-content__button.mobile {
+ display: block;
+ }
+ }
}
}
}
diff --git a/src/components/Layout/Layout.js b/src/components/Layout/Layout.js
index 5712f53..7a94e17 100644
--- a/src/components/Layout/Layout.js
+++ b/src/components/Layout/Layout.js
@@ -2,14 +2,31 @@ import React from "react"
import Header from "../Header/Header"
import Footer from "../Footer/Footer"
-const Layout = ({ children }) => {
- return (
- <>
-
- {children}
-
- >
- )
+import { HeaderAMP } from '../../lib/amp'
+
+const Layout = ({ children, amp }) => {
+
+ /*
+ amp is accelerated mobile pages
+ */
+
+ if (!amp) {
+ return (
+ <>
+
+ {children}
+
+ >
+ )
+ } else {
+ return (
+ <>
+
+ {children}
+
+ >
+ )
+ }
}
export default Layout
diff --git a/src/components/SEO/SEO.js b/src/components/SEO/SEO.js
index e1ed626..fa4a826 100644
--- a/src/components/SEO/SEO.js
+++ b/src/components/SEO/SEO.js
@@ -12,6 +12,7 @@ const SEO = ({
image,
type,
canonical,
+ url
}) => {
const { pathname } = useLocation()
const { siteMetadata } = useSiteMetadataQuery()
@@ -24,7 +25,7 @@ const SEO = ({
image: image || "custom image url...",
description: description || siteMetadata.description,
keywords: keywords || siteMetadata.keywords,
- url: `${siteMetadata.siteUrl}${pathname}`,
+ url: url || `${siteMetadata.siteUrl}${pathname}`,
canonical: canonical || `${siteMetadata.siteUrl}${pathname}`,
}
diff --git a/src/lib/amp.js b/src/lib/amp.js
new file mode 100644
index 0000000..4bafa92
--- /dev/null
+++ b/src/lib/amp.js
@@ -0,0 +1,38 @@
+import React from 'react';
+import { Helmet } from 'react-helmet'
+
+import LogoIcon from '../images/logo-icon.svg'
+
+const HeaderAMP = () => {
+ return (
+ <>
+
+
+
+
+
+
+
☰
+ {/*
*/}
+
+
+
+ >
+ )
+}
+
+export { HeaderAMP }
\ No newline at end of file
diff --git a/src/styles/global.scss b/src/styles/global.scss
index e20d4ff..b4679fa 100644
--- a/src/styles/global.scss
+++ b/src/styles/global.scss
@@ -254,7 +254,6 @@ html {
body {
font-family: 'Inter', sans-serif;
margin: 0;
- margin-top: 122px;
display: flex;
height: 85%;
flex-direction: column;
@@ -262,6 +261,7 @@ body {
main {
flex: 1 0 auto;
+ margin-top: 122px;
}
svg {
diff --git a/src/templates/article.amp.js b/src/templates/article.amp.js
new file mode 100644
index 0000000..64dbd93
--- /dev/null
+++ b/src/templates/article.amp.js
@@ -0,0 +1,75 @@
+import React from "react"
+import { Main } from "../ui/ui"
+import { Grid, Row, Col } from "react-flexbox-grid"
+import SEO from "../components/SEO/SEO"
+import Article from "../components/Article/Article"
+import MoreArticles from "../components/Articles/MoreArticles/MoreArticles"
+import Newsletter from "../components/Newsletter/Newsletter"
+import { graphql } from "gatsby"
+
+const articleTemplateAmp = ({
+ data: {
+ article: { frontmatter, html },
+ site: {
+ siteMetadata: { siteUrl },
+ },
+ },
+}) => {
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ )
+}
+
+export const pageQuery = graphql`
+ query ArticleAMP($slug: String!) {
+ article: markdownRemark(frontmatter: { slug: { eq: $slug } }) {
+ html
+ frontmatter {
+ slug
+ keywords
+ title
+ image {
+ childImageSharp {
+ fluid(maxWidth: 1400) {
+ ...GatsbyImageSharpFluid
+ }
+ }
+ }
+ time
+ tags
+ description
+ date(formatString: "D MMMM YYYY", locale: "ru-RU")
+ category
+ }
+ }
+ site {
+ siteMetadata {
+ siteUrl
+ }
+ }
+ }
+`
+
+export default articleTemplateAmp
diff --git a/src/templates/articleTemplate.js b/src/templates/article.js
similarity index 100%
rename from src/templates/articleTemplate.js
rename to src/templates/article.js
diff --git a/src/templates/categoryTemplate.js b/src/templates/category.js
similarity index 100%
rename from src/templates/categoryTemplate.js
rename to src/templates/category.js
diff --git a/src/templates/snippetTemplate.js b/src/templates/snippet.js
similarity index 100%
rename from src/templates/snippetTemplate.js
rename to src/templates/snippet.js
diff --git a/src/templates/tagTemplate.js b/src/templates/tag.js
similarity index 100%
rename from src/templates/tagTemplate.js
rename to src/templates/tag.js