mirror of
https://github.com/mastermindzh/rickvanlieshout.com
synced 2025-07-27 04:32:32 +02:00
🔖 Upgrade to Gatsby 1.8.12
This commit is contained in:
80
src/templates/category-template.js
Normal file
80
src/templates/category-template.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Helmet from 'react-helmet';
|
||||
import Sidebar from '../components/Sidebar';
|
||||
import CategoryTemplateDetails from '../components/CategoryTemplateDetails';
|
||||
|
||||
class CategoryTemplate extends React.Component {
|
||||
render() {
|
||||
const { title } = this.props.data.site.siteMetadata;
|
||||
const { category } = this.props.pathContext;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Helmet title={`${category} - ${title}`} />
|
||||
<Sidebar {...this.props} />
|
||||
<CategoryTemplateDetails {...this.props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
CategoryTemplate.propTypes = {
|
||||
data: PropTypes.shape({
|
||||
site: PropTypes.shape({
|
||||
siteMetadata: PropTypes.shape({
|
||||
title: PropTypes.string.isRequired
|
||||
})
|
||||
})
|
||||
}),
|
||||
pathContext: PropTypes.shape({
|
||||
category: PropTypes.string.isRequired
|
||||
})
|
||||
};
|
||||
|
||||
export default CategoryTemplate;
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query CategoryPage($category: String) {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
subtitle
|
||||
copyright
|
||||
menu {
|
||||
label
|
||||
path
|
||||
}
|
||||
author {
|
||||
name
|
||||
email
|
||||
telegram
|
||||
twitter
|
||||
github
|
||||
rss
|
||||
vk
|
||||
}
|
||||
}
|
||||
}
|
||||
allMarkdownRemark(
|
||||
limit: 1000,
|
||||
filter: { frontmatter: { category: { eq: $category }, layout: { eq: "post" }, draft: { ne: true } } },
|
||||
sort: { order: DESC, fields: [frontmatter___date] }
|
||||
){
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
categorySlug
|
||||
}
|
||||
frontmatter {
|
||||
title
|
||||
date
|
||||
category
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
76
src/templates/page-template.js
Normal file
76
src/templates/page-template.js
Normal file
@@ -0,0 +1,76 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Helmet from 'react-helmet';
|
||||
import PageTemplateDetails from '../components/PageTemplateDetails';
|
||||
|
||||
class PageTemplate extends React.Component {
|
||||
render() {
|
||||
const { title, subtitle } = this.props.data.site.siteMetadata;
|
||||
const page = this.props.data.markdownRemark;
|
||||
|
||||
let description;
|
||||
if (page.frontmatter.description !== null) {
|
||||
description = page.frontmatter.description;
|
||||
} else {
|
||||
description = subtitle;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
<title>{`${page.frontmatter.title} - ${title}`}</title>
|
||||
<meta name="description" content={description} />
|
||||
</Helmet>
|
||||
<PageTemplateDetails {...this.props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PageTemplate.propTypes = {
|
||||
data: PropTypes.shape({
|
||||
site: PropTypes.shape({
|
||||
siteMetadata: PropTypes.shape({
|
||||
title: PropTypes.string.isRequired,
|
||||
subtitle: PropTypes.string.isRequired
|
||||
})
|
||||
}),
|
||||
markdownRemark: PropTypes.object.isRequired
|
||||
})
|
||||
};
|
||||
|
||||
export default PageTemplate;
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query PageBySlug($slug: String!) {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
subtitle
|
||||
copyright
|
||||
menu {
|
||||
label
|
||||
path
|
||||
}
|
||||
author {
|
||||
name
|
||||
email
|
||||
telegram
|
||||
twitter
|
||||
github
|
||||
rss
|
||||
vk
|
||||
}
|
||||
}
|
||||
}
|
||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||
id
|
||||
html
|
||||
frontmatter {
|
||||
title
|
||||
date
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
71
src/templates/post-template.js
Normal file
71
src/templates/post-template.js
Normal file
@@ -0,0 +1,71 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Helmet from 'react-helmet';
|
||||
import PostTemplateDetails from '../components/PostTemplateDetails';
|
||||
|
||||
class PostTemplate extends React.Component {
|
||||
render() {
|
||||
const { title, subtitle } = this.props.data.site.siteMetadata;
|
||||
const post = this.props.data.markdownRemark;
|
||||
|
||||
let description;
|
||||
if (post.frontmatter.description !== null) {
|
||||
description = post.frontmatter.description;
|
||||
} else {
|
||||
description = subtitle;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Helmet>
|
||||
<title>{`${post.frontmatter.title} - ${title}`}</title>
|
||||
<meta name="description" content={description} />
|
||||
</Helmet>
|
||||
<PostTemplateDetails {...this.props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PostTemplate.propTypes = {
|
||||
data: PropTypes.shape({
|
||||
site: PropTypes.shape({
|
||||
siteMetadata: PropTypes.shape({
|
||||
title: PropTypes.string.isRequired,
|
||||
subtitle: PropTypes.string.isRequired
|
||||
})
|
||||
}),
|
||||
markdownRemark: PropTypes.object.isRequired
|
||||
})
|
||||
};
|
||||
|
||||
export default PostTemplate;
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query PostBySlug($slug: String!) {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
subtitle
|
||||
copyright
|
||||
author {
|
||||
name
|
||||
twitter
|
||||
}
|
||||
}
|
||||
}
|
||||
markdownRemark(fields: { slug: { eq: $slug } }) {
|
||||
id
|
||||
html
|
||||
fields {
|
||||
tagSlugs
|
||||
}
|
||||
frontmatter {
|
||||
title
|
||||
tags
|
||||
date
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
80
src/templates/tag-template.js
Normal file
80
src/templates/tag-template.js
Normal file
@@ -0,0 +1,80 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Helmet from 'react-helmet';
|
||||
import Sidebar from '../components/Sidebar';
|
||||
import TagTemplateDetails from '../components/TagTemplateDetails';
|
||||
|
||||
class TagTemplate extends React.Component {
|
||||
render() {
|
||||
const { title } = this.props.data.site.siteMetadata;
|
||||
const { tag } = this.props.pathContext;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Helmet title={`All Posts tagget as "${tag}" - ${title}`} />
|
||||
<Sidebar {...this.props} />
|
||||
<TagTemplateDetails {...this.props} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
TagTemplate.propTypes = {
|
||||
data: PropTypes.shape({
|
||||
site: PropTypes.shape({
|
||||
siteMetadata: PropTypes.shape({
|
||||
title: PropTypes.string.isRequired
|
||||
})
|
||||
})
|
||||
}),
|
||||
pathContext: PropTypes.shape({
|
||||
tag: PropTypes.string.isRequired
|
||||
})
|
||||
};
|
||||
|
||||
export default TagTemplate;
|
||||
|
||||
export const pageQuery = graphql`
|
||||
query TagPage($tag: String) {
|
||||
site {
|
||||
siteMetadata {
|
||||
title
|
||||
subtitle
|
||||
copyright
|
||||
menu {
|
||||
label
|
||||
path
|
||||
}
|
||||
author {
|
||||
name
|
||||
email
|
||||
telegram
|
||||
twitter
|
||||
github
|
||||
rss
|
||||
vk
|
||||
}
|
||||
}
|
||||
}
|
||||
allMarkdownRemark(
|
||||
limit: 1000,
|
||||
filter: { frontmatter: { tags: { in: [$tag] }, layout: { eq: "post" }, draft: { ne: true } } },
|
||||
sort: { order: DESC, fields: [frontmatter___date] }
|
||||
){
|
||||
edges {
|
||||
node {
|
||||
fields {
|
||||
slug
|
||||
categorySlug
|
||||
}
|
||||
frontmatter {
|
||||
title
|
||||
date
|
||||
category
|
||||
description
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
Reference in New Issue
Block a user