From f2721c454214f3a65dc2887d3ec7df56cea39f74 Mon Sep 17 00:00:00 2001 From: Robert Veitch Date: Wed, 11 Dec 2019 22:27:28 -0600 Subject: [PATCH 1/2] Update slug format for post type Posts no longer need to specify a full url for the resulting html. Rather, the prefix portion of the url will be inferred from the post's location in the source filesystem. The post slug now simply represents a url friendly version of the title. Additionally, updates all sample posts to use the new slug format. --- content/posts/2016-01-09---Perfecting-the-Art-of-Perfection.md | 2 +- .../2016-01-12---The-Origins-of-Social-Stationery-Lettering.md | 2 +- content/posts/2016-02-02---A-Brief-History-of-Typography.md | 2 +- content/posts/2017-18-08---The-Birth-of-Movable-Type.md | 2 +- .../posts/2017-19-08---Humane-Typography-in-the-Digital-Age.md | 2 +- gatsby/on-create-node.js | 3 ++- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/content/posts/2016-01-09---Perfecting-the-Art-of-Perfection.md b/content/posts/2016-01-09---Perfecting-the-Art-of-Perfection.md index 99fe877..42928f2 100644 --- a/content/posts/2016-01-09---Perfecting-the-Art-of-Perfection.md +++ b/content/posts/2016-01-09---Perfecting-the-Art-of-Perfection.md @@ -3,7 +3,7 @@ title: Perfecting the Art of Perfection date: "2016-09-01T23:46:37.121Z" template: "post" draft: false -slug: "/posts/perfecting-the-art-of-perfection/" +slug: "perfecting-the-art-of-perfection" category: "Design Inspiration" tags: - "Handwriting" diff --git a/content/posts/2016-01-12---The-Origins-of-Social-Stationery-Lettering.md b/content/posts/2016-01-12---The-Origins-of-Social-Stationery-Lettering.md index 868fdd3..885fd58 100644 --- a/content/posts/2016-01-12---The-Origins-of-Social-Stationery-Lettering.md +++ b/content/posts/2016-01-12---The-Origins-of-Social-Stationery-Lettering.md @@ -3,7 +3,7 @@ title: The Origins of Social Stationery Lettering date: "2016-12-01T22:40:32.169Z" template: "post" draft: false -slug: "/posts/the-origins-of-social-stationery-lettering" +slug: "the-origins-of-social-stationery-lettering" category: "Design Culture" description: "Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante." socialImage: "/media/image-3.jpg" diff --git a/content/posts/2016-02-02---A-Brief-History-of-Typography.md b/content/posts/2016-02-02---A-Brief-History-of-Typography.md index 4e4e5fc..788a8a6 100644 --- a/content/posts/2016-02-02---A-Brief-History-of-Typography.md +++ b/content/posts/2016-02-02---A-Brief-History-of-Typography.md @@ -3,7 +3,7 @@ title: "A Brief History of Typography" date: "2016-02-02T22:40:32.169Z" template: "post" draft: false -slug: "/posts/a-brief-history-of-typography/" +slug: "a-brief-history-of-typography" category: "Design Inspiration" tags: - "Linotype" diff --git a/content/posts/2017-18-08---The-Birth-of-Movable-Type.md b/content/posts/2017-18-08---The-Birth-of-Movable-Type.md index fa6f86d..a5a0f91 100644 --- a/content/posts/2017-18-08---The-Birth-of-Movable-Type.md +++ b/content/posts/2017-18-08---The-Birth-of-Movable-Type.md @@ -3,7 +3,7 @@ title: "Johannes Gutenberg: The Birth of Movable Type" date: "2017-08-18T22:12:03.284Z" template: "post" draft: false -slug: "/posts/the-birth-of-movable-type/" +slug: "the-birth-of-movable-type" category: "Typography" tags: - "Open source" diff --git a/content/posts/2017-19-08---Humane-Typography-in-the-Digital-Age.md b/content/posts/2017-19-08---Humane-Typography-in-the-Digital-Age.md index 952a4c1..0109d39 100644 --- a/content/posts/2017-19-08---Humane-Typography-in-the-Digital-Age.md +++ b/content/posts/2017-19-08---Humane-Typography-in-the-Digital-Age.md @@ -3,7 +3,7 @@ title: Humane Typography in the Digital Age date: "2017-08-19T22:40:32.169Z" template: "post" draft: false -slug: "/posts/humane-typography-in-the-digital-age/" +slug: "humane-typography-in-the-digital-age" category: "Typography" tags: - "Design" diff --git a/gatsby/on-create-node.js b/gatsby/on-create-node.js index 8eedd7e..7fa665f 100644 --- a/gatsby/on-create-node.js +++ b/gatsby/on-create-node.js @@ -8,10 +8,11 @@ const onCreateNode = ({ node, actions, getNode }) => { if (node.internal.type === 'MarkdownRemark') { if (typeof node.frontmatter.slug !== 'undefined') { + const dirname = getNode(node.parent).relativeDirectory; createNodeField({ node, name: 'slug', - value: node.frontmatter.slug + value: `/${dirname}/${node.frontmatter.slug}` }); } else { const value = createFilePath({ node, getNode }); From 308b40cf90d9be240dc7a82215aa428e49d34663 Mon Sep 17 00:00:00 2001 From: Robert Veitch Date: Wed, 11 Dec 2019 22:36:11 -0600 Subject: [PATCH 2/2] Add support for Netlify CMS preview_path preview_path allows for UI linkage between the Netlify CMS UI and the associated preview deploy build. Also adds a commented out publish_mode configuration to enable the UI authoring flow, which continues to default to publish direct to master. --- static/admin/config.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/static/admin/config.yml b/static/admin/config.yml index fd52f50..94d0fb9 100644 --- a/static/admin/config.yml +++ b/static/admin/config.yml @@ -5,12 +5,17 @@ backend: media_folder: "static/media" public_folder: "/media" +# Uncomment to leverage Netlify CMS UI authoring flow +# see: https://www.netlifycms.org/docs/configuration-options/#publish-mode +# publish_mode: editorial_workflow + collections: - name: "posts" label: "Posts" folder: "content/posts" create: true slug: "{{year}}-{{month}}-{{day}}-{{slug}}" + preview_path: "posts/{{fields.slug}}" fields: - {label: "Template", name: "template", widget: "hidden", default: "post"} - {label: "Title", name: "title", widget: "string"}