Change frontmatter fields

This commit is contained in:
alxshelepenok 2018-11-11 19:32:51 +03:00
parent de05e137ba
commit 440d4e88c7
19 changed files with 26 additions and 26 deletions

View File

Before

Width:  |  Height:  |  Size: 2.7 MiB

After

Width:  |  Height:  |  Size: 2.7 MiB

View File

@ -1,7 +1,7 @@
--- ---
title: "About me" title: "About me"
layout: page slug: "/about"
path: "/about" template: "page"
--- ---
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante.

View File

Before

Width:  |  Height:  |  Size: 721 KiB

After

Width:  |  Height:  |  Size: 721 KiB

View File

@ -1,7 +1,7 @@
--- ---
title: "Contact me" title: "Contact me"
layout: page slug: "/contact"
path: "/contact" template: "page"
--- ---
Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat. Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.

View File

@ -1,9 +1,9 @@
--- ---
title: Perfecting the Art of Perfection title: Perfecting the Art of Perfection
date: "2016-09-01T23:46:37.121Z" date: "2016-09-01T23:46:37.121Z"
layout: post template: "post"
draft: false draft: false
path: "/posts/perfecting-the-art-of-perfection/" slug: "/posts/perfecting-the-art-of-perfection/"
category: "Design Inspiration" category: "Design Inspiration"
tags: tags:
- "Handwriting" - "Handwriting"

View File

@ -1,9 +1,9 @@
--- ---
title: The Origins of Social Stationery Lettering title: The Origins of Social Stationery Lettering
date: "2016-12-01T22:40:32.169Z" date: "2016-12-01T22:40:32.169Z"
layout: post template: "post"
draft: false draft: false
path: "/posts/the-origins-of-social-stationery-lettering" slug: "/posts/the-origins-of-social-stationery-lettering"
category: "Design Culture" category: "Design Culture"
tags: tags:
- "Typefaces" - "Typefaces"

View File

@ -1,9 +1,9 @@
--- ---
title: "A Brief History of Typography" title: "A Brief History of Typography"
date: "2016-02-02T22:40:32.169Z" date: "2016-02-02T22:40:32.169Z"
layout: post template: "post"
draft: false draft: false
path: "/posts/a-brief-history-of-typography/" slug: "/posts/a-brief-history-of-typography/"
category: "Design Inspiration" category: "Design Inspiration"
tags: tags:
- "Linotype" - "Linotype"

View File

@ -1,9 +1,9 @@
--- ---
title: "Johannes Gutenberg: The Birth of Movable Type" title: "Johannes Gutenberg: The Birth of Movable Type"
date: "2017-08-18T22:12:03.284Z" date: "2017-08-18T22:12:03.284Z"
layout: post template: "post"
draft: false draft: false
path: "/posts/the-birth-of-movable-type/" slug: "/posts/the-birth-of-movable-type/"
category: "Typography" category: "Typography"
tags: tags:
- "Open source" - "Open source"

View File

@ -1,9 +1,9 @@
--- ---
title: Humane Typography in the Digital Age title: Humane Typography in the Digital Age
date: "2017-08-19T22:40:32.169Z" date: "2017-08-19T22:40:32.169Z"
layout: post template: "post"
draft: false draft: false
path: "/posts/humane-typography-in-the-digital-age/" slug: "/posts/humane-typography-in-the-digital-age/"
category: "Typography" category: "Typography"
tags: tags:
- "Design" - "Design"

View File

@ -36,7 +36,7 @@ const createPages = async ({ graphql, actions }) => {
edges { edges {
node { node {
frontmatter { frontmatter {
layout template
} }
fields { fields {
slug slug
@ -50,13 +50,13 @@ const createPages = async ({ graphql, actions }) => {
const { edges } = result.data.allMarkdownRemark; const { edges } = result.data.allMarkdownRemark;
_.each(edges, (edge) => { _.each(edges, (edge) => {
if (_.get(edge, 'node.frontmatter.layout') === 'page') { if (_.get(edge, 'node.frontmatter.template') === 'page') {
createPage({ createPage({
path: edge.node.fields.slug, path: edge.node.fields.slug,
component: path.resolve('./src/templates/page-template.js'), component: path.resolve('./src/templates/page-template.js'),
context: { slug: edge.node.fields.slug } context: { slug: edge.node.fields.slug }
}); });
} else if (_.get(edge, 'node.frontmatter.layout') === 'post') { } else if (_.get(edge, 'node.frontmatter.template') === 'post') {
createPage({ createPage({
path: edge.node.fields.slug, path: edge.node.fields.slug,
component: path.resolve('./src/templates/post-template.js'), component: path.resolve('./src/templates/post-template.js'),

View File

@ -14,7 +14,7 @@ const onCreateNode = ({ node, actions, getNode }) => {
createNodeField({ createNodeField({
node, node,
name: 'slug', name: 'slug',
value: node.frontmatter.path value: node.frontmatter.slug
}); });
} else { } else {
const value = createFilePath({ node, getNode }); const value = createFilePath({ node, getNode });

View File

@ -11,7 +11,7 @@ module.exports = async (graphql, actions) => {
const result = await graphql(` const result = await graphql(`
{ {
allMarkdownRemark( allMarkdownRemark(
filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } } filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) { ) {
group(field: frontmatter___category) { group(field: frontmatter___category) {
fieldValue fieldValue

View File

@ -9,7 +9,7 @@ module.exports = async (graphql, actions) => {
const result = await graphql(` const result = await graphql(`
{ {
allMarkdownRemark( allMarkdownRemark(
filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } } filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) { totalCount } ) { totalCount }
} }
`); `);

View File

@ -11,7 +11,7 @@ module.exports = async (graphql, actions) => {
const result = await graphql(` const result = await graphql(`
{ {
allMarkdownRemark( allMarkdownRemark(
filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } } filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) { ) {
group(field: frontmatter___tags) { group(field: frontmatter___tags) {
fieldValue fieldValue

View File

@ -40,7 +40,7 @@ export const query = graphql`
} }
} }
allMarkdownRemark( allMarkdownRemark(
filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } } filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) { ) {
group(field: frontmatter___category) { group(field: frontmatter___category) {
fieldValue fieldValue

View File

@ -51,7 +51,7 @@ export const query = graphql`
allMarkdownRemark( allMarkdownRemark(
limit: $postsLimit, limit: $postsLimit,
skip: $postsOffset, skip: $postsOffset,
filter: { frontmatter: { category: { eq: $category }, layout: { eq: "post" }, draft: { ne: true } } }, filter: { frontmatter: { category: { eq: $category }, template: { eq: "post" }, draft: { ne: true } } },
sort: { order: DESC, fields: [frontmatter___date] } sort: { order: DESC, fields: [frontmatter___date] }
){ ){
edges { edges {

View File

@ -50,7 +50,7 @@ export const query = graphql`
allMarkdownRemark( allMarkdownRemark(
limit: $postsLimit, limit: $postsLimit,
skip: $postsOffset, skip: $postsOffset,
filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } }, filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } },
sort: { order: DESC, fields: [frontmatter___date] } sort: { order: DESC, fields: [frontmatter___date] }
){ ){
edges { edges {

View File

@ -51,7 +51,7 @@ export const query = graphql`
allMarkdownRemark( allMarkdownRemark(
limit: $postsLimit, limit: $postsLimit,
skip: $postsOffset, skip: $postsOffset,
filter: { frontmatter: { tags: { in: [$tag] }, layout: { eq: "post" }, draft: { ne: true } } }, filter: { frontmatter: { tags: { in: [$tag] }, template: { eq: "post" }, draft: { ne: true } } },
sort: { order: DESC, fields: [frontmatter___date] } sort: { order: DESC, fields: [frontmatter___date] }
){ ){
edges { edges {

View File

@ -39,7 +39,7 @@ export const query = graphql`
} }
} }
allMarkdownRemark( allMarkdownRemark(
filter: { frontmatter: { layout: { eq: "post" }, draft: { ne: true } } } filter: { frontmatter: { template: { eq: "post" }, draft: { ne: true } } }
) { ) {
group(field: frontmatter___tags) { group(field: frontmatter___tags) {
fieldValue fieldValue