From 34398adeaffd999e206da268372b7376e9cdcf50 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Tue, 11 May 2021 13:39:09 -0700 Subject: [PATCH 1/5] Rename blog posts to include date --- ...-release-1-0.mdx => 2017-10-01-bucklescript-release-1-0.mdx} | 0 ...ease-1-4-2.mdx => 2017-10-02-bucklescript-release-1-4-2.mdx} | 0 ...ease-1-4-3.mdx => 2017-10-03-bucklescript-release-1-4-3.mdx} | 0 ...ease-1-5-0.mdx => 2017-10-04-bucklescript-release-1-5-0.mdx} | 0 ...ease-1-5-1.mdx => 2017-10-05-bucklescript-release-1-5-1.mdx} | 0 ...ease-1-5-2.mdx => 2017-10-06-bucklescript-release-1-5-2.mdx} | 0 ...ease-1-7-0.mdx => 2017-10-07-bucklescript-release-1-7-0.mdx} | 0 ...ease-1-7-4.mdx => 2017-10-08-bucklescript-release-1-7-4.mdx} | 0 ...ease-1-7-5.mdx => 2017-10-09-bucklescript-release-1-7-5.mdx} | 0 ...escript.mdx => 2018-03-13-a-small-step-for-bucklescript.mdx} | 0 ...ease-3-0-0.mdx => 2018-04-16-bucklescript-release-3-0-0.mdx} | 0 ...ease-3-1-0.mdx => 2018-05-21-bucklescript-release-3-1-0.mdx} | 0 ...ease-3-1-4.mdx => 2018-05-23-bucklescript-release-3-1-4.mdx} | 0 ...-0-pt1.mdx => 2018-07-17-bucklescript-release-4-0-0-pt1.mdx} | 2 +- ...-0-pt2.mdx => 2018-07-17-bucklescript-release-4-0-0-pt2.mdx} | 2 +- .../archive/{arity-zero.mdx => 2018-11-13-arity-zero.mdx} | 0 ...4-2018.mdx => 2018-11-19-bucklescript-roadmap-q3-4-2018.mdx} | 0 ...ease-4-0-8.mdx => 2018-12-05-bucklescript-release-4-0-8.mdx} | 0 ...se-4-0-17.mdx => 2019-01-07-bucklescript-release-4-0-17.mdx} | 0 _blogposts/archive/{scalable.mdx => 2019-01-11-scalable.mdx} | 0 ...iew-variadic.mdx => 2019-03-01-feature-preview-variadic.mdx} | 2 +- ...-release-5-0.mdx => 2019-03-21-bucklescript-release-5-0.mdx} | 0 ...-release-6-0.mdx => 2019-03-31-bucklescript-release-6-0.mdx} | 0 ...ease-5-0-1.mdx => 2019-04-09-bucklescript-release-5-0-1.mdx} | 0 ...ease-5-0-4.mdx => 2019-04-22-bucklescript-release-5-0-4.mdx} | 0 .../archive/{ffi-overview.mdx => 2019-05-21-ffi-overview.mdx} | 0 ...ease-5-0-5.mdx => 2019-06-26-bucklescript-release-5-0-5.mdx} | 0 ...ease-5-1-0.mdx => 2019-08-12-bucklescript-release-5-1-0.mdx} | 0 ...ease-5-2-0.mdx => 2019-09-23-bucklescript-release-5-2-0.mdx} | 0 .../{another-encoding.mdx => 2019-10-16-another-encoding.mdx} | 0 ...whats-new-in-7-pt1.mdx => 2019-11-18-whats-new-in-7-pt1.mdx} | 0 ...whats-new-in-7-pt2.mdx => 2019-11-28-whats-new-in-7-pt2.mdx} | 0 ...ease-7-0-2.mdx => 2019-12-20-bucklescript-release-7-0-2.mdx} | 0 ...ease-7-1-0.mdx => 2020-02-04-bucklescript-release-7-1-0.mdx} | 0 ...klescript.mdx => 2020-02-07-union-types-in-bucklescript.mdx} | 0 ...ib-in-memory.mdx => 2020-02-20-loading-stdlib-in-memory.mdx} | 0 ...-release-7-2.mdx => 2020-03-12-bucklescript-release-7-2.mdx} | 0 ...generalize-uncurry.mdx => 2020-03-26-generalize-uncurry.mdx} | 0 ...-release-7-3.mdx => 2020-04-13-bucklescript-release-7-3.mdx} | 0 ...ncoding.mdx => 2020-05-06-a-story-of-exception-encoding.mdx} | 2 +- ...pt1.mdx => 2020-05-06-state-of-reasonml-org-2020-q2-pt1.mdx} | 0 ...pt2.mdx => 2020-05-11-state-of-reasonml-org-2020-q2-pt2.mdx} | 0 ...pt3.mdx => 2020-05-12-state-of-reasonml-org-2020-q2-pt3.mdx} | 0 ...azy-encoding.mdx => 2020-05-15-a-story-of-lazy-encoding.mdx} | 2 +- ...pt4.mdx => 2020-05-15-state-of-reasonml-org-2020-q2-pt4.mdx} | 0 ...new_encoding.mdx => 2020-06-22-overview-of-new_encoding.mdx} | 2 +- ...ew-syntax.mdx => 2020-07-01-bucklescript-8-1-new-syntax.mdx} | 0 ...> 2020-07-06-a-note-on-bucklescripts-future-commitments.mdx} | 0 ...ease-8-1-1.mdx => 2020-07-17-bucklescript-release-8-1-1.mdx} | 0 ...reason.mdx => 2020-07-28-string-literal-types-in-reason.mdx} | 2 +- ...-release-8-2.mdx => 2020-08-03-bucklescript-release-8-2.mdx} | 0 51 files changed, 7 insertions(+), 7 deletions(-) rename _blogposts/archive/{bucklescript-release-1-0.mdx => 2017-10-01-bucklescript-release-1-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-4-2.mdx => 2017-10-02-bucklescript-release-1-4-2.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-4-3.mdx => 2017-10-03-bucklescript-release-1-4-3.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-5-0.mdx => 2017-10-04-bucklescript-release-1-5-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-5-1.mdx => 2017-10-05-bucklescript-release-1-5-1.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-5-2.mdx => 2017-10-06-bucklescript-release-1-5-2.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-7-0.mdx => 2017-10-07-bucklescript-release-1-7-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-7-4.mdx => 2017-10-08-bucklescript-release-1-7-4.mdx} (100%) rename _blogposts/archive/{bucklescript-release-1-7-5.mdx => 2017-10-09-bucklescript-release-1-7-5.mdx} (100%) rename _blogposts/archive/{a-small-step-for-bucklescript.mdx => 2018-03-13-a-small-step-for-bucklescript.mdx} (100%) rename _blogposts/archive/{bucklescript-release-3-0-0.mdx => 2018-04-16-bucklescript-release-3-0-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-3-1-0.mdx => 2018-05-21-bucklescript-release-3-1-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-3-1-4.mdx => 2018-05-23-bucklescript-release-3-1-4.mdx} (100%) rename _blogposts/archive/{bucklescript-release-4-0-0-pt1.mdx => 2018-07-17-bucklescript-release-4-0-0-pt1.mdx} (99%) rename _blogposts/archive/{bucklescript-release-4-0-0-pt2.mdx => 2018-07-17-bucklescript-release-4-0-0-pt2.mdx} (98%) rename _blogposts/archive/{arity-zero.mdx => 2018-11-13-arity-zero.mdx} (100%) rename _blogposts/archive/{bucklescript-roadmap-q3-4-2018.mdx => 2018-11-19-bucklescript-roadmap-q3-4-2018.mdx} (100%) rename _blogposts/archive/{bucklescript-release-4-0-8.mdx => 2018-12-05-bucklescript-release-4-0-8.mdx} (100%) rename _blogposts/archive/{bucklescript-release-4-0-17.mdx => 2019-01-07-bucklescript-release-4-0-17.mdx} (100%) rename _blogposts/archive/{scalable.mdx => 2019-01-11-scalable.mdx} (100%) rename _blogposts/archive/{feature-preview-variadic.mdx => 2019-03-01-feature-preview-variadic.mdx} (98%) rename _blogposts/archive/{bucklescript-release-5-0.mdx => 2019-03-21-bucklescript-release-5-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-6-0.mdx => 2019-03-31-bucklescript-release-6-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-5-0-1.mdx => 2019-04-09-bucklescript-release-5-0-1.mdx} (100%) rename _blogposts/archive/{bucklescript-release-5-0-4.mdx => 2019-04-22-bucklescript-release-5-0-4.mdx} (100%) rename _blogposts/archive/{ffi-overview.mdx => 2019-05-21-ffi-overview.mdx} (100%) rename _blogposts/archive/{bucklescript-release-5-0-5.mdx => 2019-06-26-bucklescript-release-5-0-5.mdx} (100%) rename _blogposts/archive/{bucklescript-release-5-1-0.mdx => 2019-08-12-bucklescript-release-5-1-0.mdx} (100%) rename _blogposts/archive/{bucklescript-release-5-2-0.mdx => 2019-09-23-bucklescript-release-5-2-0.mdx} (100%) rename _blogposts/archive/{another-encoding.mdx => 2019-10-16-another-encoding.mdx} (100%) rename _blogposts/archive/{whats-new-in-7-pt1.mdx => 2019-11-18-whats-new-in-7-pt1.mdx} (100%) rename _blogposts/archive/{whats-new-in-7-pt2.mdx => 2019-11-28-whats-new-in-7-pt2.mdx} (100%) rename _blogposts/archive/{bucklescript-release-7-0-2.mdx => 2019-12-20-bucklescript-release-7-0-2.mdx} (100%) rename _blogposts/archive/{bucklescript-release-7-1-0.mdx => 2020-02-04-bucklescript-release-7-1-0.mdx} (100%) rename _blogposts/archive/{union-types-in-bucklescript.mdx => 2020-02-07-union-types-in-bucklescript.mdx} (100%) rename _blogposts/archive/{loading-stdlib-in-memory.mdx => 2020-02-20-loading-stdlib-in-memory.mdx} (100%) rename _blogposts/archive/{bucklescript-release-7-2.mdx => 2020-03-12-bucklescript-release-7-2.mdx} (100%) rename _blogposts/archive/{generalize-uncurry.mdx => 2020-03-26-generalize-uncurry.mdx} (100%) rename _blogposts/archive/{bucklescript-release-7-3.mdx => 2020-04-13-bucklescript-release-7-3.mdx} (100%) rename _blogposts/archive/{a-story-of-exception-encoding.mdx => 2020-05-06-a-story-of-exception-encoding.mdx} (99%) rename _blogposts/archive/{state-of-reasonml-org-2020-q2-pt1.mdx => 2020-05-06-state-of-reasonml-org-2020-q2-pt1.mdx} (100%) rename _blogposts/archive/{state-of-reasonml-org-2020-q2-pt2.mdx => 2020-05-11-state-of-reasonml-org-2020-q2-pt2.mdx} (100%) rename _blogposts/archive/{state-of-reasonml-org-2020-q2-pt3.mdx => 2020-05-12-state-of-reasonml-org-2020-q2-pt3.mdx} (100%) rename _blogposts/archive/{a-story-of-lazy-encoding.mdx => 2020-05-15-a-story-of-lazy-encoding.mdx} (99%) rename _blogposts/archive/{state-of-reasonml-org-2020-q2-pt4.mdx => 2020-05-15-state-of-reasonml-org-2020-q2-pt4.mdx} (100%) rename _blogposts/archive/{overview-of-new_encoding.mdx => 2020-06-22-overview-of-new_encoding.mdx} (99%) rename _blogposts/archive/{bucklescript-8-1-new-syntax.mdx => 2020-07-01-bucklescript-8-1-new-syntax.mdx} (100%) rename _blogposts/archive/{a-note-on-bucklescripts-future-commitments.mdx => 2020-07-06-a-note-on-bucklescripts-future-commitments.mdx} (100%) rename _blogposts/archive/{bucklescript-release-8-1-1.mdx => 2020-07-17-bucklescript-release-8-1-1.mdx} (100%) rename _blogposts/archive/{string-literal-types-in-reason.mdx => 2020-07-28-string-literal-types-in-reason.mdx} (99%) rename _blogposts/archive/{bucklescript-release-8-2.mdx => 2020-08-03-bucklescript-release-8-2.mdx} (100%) diff --git a/_blogposts/archive/bucklescript-release-1-0.mdx b/_blogposts/archive/2017-10-01-bucklescript-release-1-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-0.mdx rename to _blogposts/archive/2017-10-01-bucklescript-release-1-0.mdx diff --git a/_blogposts/archive/bucklescript-release-1-4-2.mdx b/_blogposts/archive/2017-10-02-bucklescript-release-1-4-2.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-4-2.mdx rename to _blogposts/archive/2017-10-02-bucklescript-release-1-4-2.mdx diff --git a/_blogposts/archive/bucklescript-release-1-4-3.mdx b/_blogposts/archive/2017-10-03-bucklescript-release-1-4-3.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-4-3.mdx rename to _blogposts/archive/2017-10-03-bucklescript-release-1-4-3.mdx diff --git a/_blogposts/archive/bucklescript-release-1-5-0.mdx b/_blogposts/archive/2017-10-04-bucklescript-release-1-5-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-5-0.mdx rename to _blogposts/archive/2017-10-04-bucklescript-release-1-5-0.mdx diff --git a/_blogposts/archive/bucklescript-release-1-5-1.mdx b/_blogposts/archive/2017-10-05-bucklescript-release-1-5-1.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-5-1.mdx rename to _blogposts/archive/2017-10-05-bucklescript-release-1-5-1.mdx diff --git a/_blogposts/archive/bucklescript-release-1-5-2.mdx b/_blogposts/archive/2017-10-06-bucklescript-release-1-5-2.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-5-2.mdx rename to _blogposts/archive/2017-10-06-bucklescript-release-1-5-2.mdx diff --git a/_blogposts/archive/bucklescript-release-1-7-0.mdx b/_blogposts/archive/2017-10-07-bucklescript-release-1-7-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-7-0.mdx rename to _blogposts/archive/2017-10-07-bucklescript-release-1-7-0.mdx diff --git a/_blogposts/archive/bucklescript-release-1-7-4.mdx b/_blogposts/archive/2017-10-08-bucklescript-release-1-7-4.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-7-4.mdx rename to _blogposts/archive/2017-10-08-bucklescript-release-1-7-4.mdx diff --git a/_blogposts/archive/bucklescript-release-1-7-5.mdx b/_blogposts/archive/2017-10-09-bucklescript-release-1-7-5.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-1-7-5.mdx rename to _blogposts/archive/2017-10-09-bucklescript-release-1-7-5.mdx diff --git a/_blogposts/archive/a-small-step-for-bucklescript.mdx b/_blogposts/archive/2018-03-13-a-small-step-for-bucklescript.mdx similarity index 100% rename from _blogposts/archive/a-small-step-for-bucklescript.mdx rename to _blogposts/archive/2018-03-13-a-small-step-for-bucklescript.mdx diff --git a/_blogposts/archive/bucklescript-release-3-0-0.mdx b/_blogposts/archive/2018-04-16-bucklescript-release-3-0-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-3-0-0.mdx rename to _blogposts/archive/2018-04-16-bucklescript-release-3-0-0.mdx diff --git a/_blogposts/archive/bucklescript-release-3-1-0.mdx b/_blogposts/archive/2018-05-21-bucklescript-release-3-1-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-3-1-0.mdx rename to _blogposts/archive/2018-05-21-bucklescript-release-3-1-0.mdx diff --git a/_blogposts/archive/bucklescript-release-3-1-4.mdx b/_blogposts/archive/2018-05-23-bucklescript-release-3-1-4.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-3-1-4.mdx rename to _blogposts/archive/2018-05-23-bucklescript-release-3-1-4.mdx diff --git a/_blogposts/archive/bucklescript-release-4-0-0-pt1.mdx b/_blogposts/archive/2018-07-17-bucklescript-release-4-0-0-pt1.mdx similarity index 99% rename from _blogposts/archive/bucklescript-release-4-0-0-pt1.mdx rename to _blogposts/archive/2018-07-17-bucklescript-release-4-0-0-pt1.mdx index 10adaaffd..3c3e637df 100644 --- a/_blogposts/archive/bucklescript-release-4-0-0-pt1.mdx +++ b/_blogposts/archive/2018-07-17-bucklescript-release-4-0-0-pt1.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2018-07-17 8:00" +date: "2018-07-17" previewImg: badge: release title: Announcing BuckleScript 4.0 (Part One) diff --git a/_blogposts/archive/bucklescript-release-4-0-0-pt2.mdx b/_blogposts/archive/2018-07-17-bucklescript-release-4-0-0-pt2.mdx similarity index 98% rename from _blogposts/archive/bucklescript-release-4-0-0-pt2.mdx rename to _blogposts/archive/2018-07-17-bucklescript-release-4-0-0-pt2.mdx index ed40b6d22..943db6237 100644 --- a/_blogposts/archive/bucklescript-release-4-0-0-pt2.mdx +++ b/_blogposts/archive/2018-07-17-bucklescript-release-4-0-0-pt2.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2018-07-17 17:00" +date: "2018-07-17" previewImg: badge: release title: Announcing BuckleScript 4.0 (Part Two) diff --git a/_blogposts/archive/arity-zero.mdx b/_blogposts/archive/2018-11-13-arity-zero.mdx similarity index 100% rename from _blogposts/archive/arity-zero.mdx rename to _blogposts/archive/2018-11-13-arity-zero.mdx diff --git a/_blogposts/archive/bucklescript-roadmap-q3-4-2018.mdx b/_blogposts/archive/2018-11-19-bucklescript-roadmap-q3-4-2018.mdx similarity index 100% rename from _blogposts/archive/bucklescript-roadmap-q3-4-2018.mdx rename to _blogposts/archive/2018-11-19-bucklescript-roadmap-q3-4-2018.mdx diff --git a/_blogposts/archive/bucklescript-release-4-0-8.mdx b/_blogposts/archive/2018-12-05-bucklescript-release-4-0-8.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-4-0-8.mdx rename to _blogposts/archive/2018-12-05-bucklescript-release-4-0-8.mdx diff --git a/_blogposts/archive/bucklescript-release-4-0-17.mdx b/_blogposts/archive/2019-01-07-bucklescript-release-4-0-17.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-4-0-17.mdx rename to _blogposts/archive/2019-01-07-bucklescript-release-4-0-17.mdx diff --git a/_blogposts/archive/scalable.mdx b/_blogposts/archive/2019-01-11-scalable.mdx similarity index 100% rename from _blogposts/archive/scalable.mdx rename to _blogposts/archive/2019-01-11-scalable.mdx diff --git a/_blogposts/archive/feature-preview-variadic.mdx b/_blogposts/archive/2019-03-01-feature-preview-variadic.mdx similarity index 98% rename from _blogposts/archive/feature-preview-variadic.mdx rename to _blogposts/archive/2019-03-01-feature-preview-variadic.mdx index 121906262..1d983763a 100644 --- a/_blogposts/archive/feature-preview-variadic.mdx +++ b/_blogposts/archive/2019-03-01-feature-preview-variadic.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2019-03-1" +date: "2019-03-01" previewImg: badge: preview title: First-class bs.variadic Support in the Next Release diff --git a/_blogposts/archive/bucklescript-release-5-0.mdx b/_blogposts/archive/2019-03-21-bucklescript-release-5-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-5-0.mdx rename to _blogposts/archive/2019-03-21-bucklescript-release-5-0.mdx diff --git a/_blogposts/archive/bucklescript-release-6-0.mdx b/_blogposts/archive/2019-03-31-bucklescript-release-6-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-6-0.mdx rename to _blogposts/archive/2019-03-31-bucklescript-release-6-0.mdx diff --git a/_blogposts/archive/bucklescript-release-5-0-1.mdx b/_blogposts/archive/2019-04-09-bucklescript-release-5-0-1.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-5-0-1.mdx rename to _blogposts/archive/2019-04-09-bucklescript-release-5-0-1.mdx diff --git a/_blogposts/archive/bucklescript-release-5-0-4.mdx b/_blogposts/archive/2019-04-22-bucklescript-release-5-0-4.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-5-0-4.mdx rename to _blogposts/archive/2019-04-22-bucklescript-release-5-0-4.mdx diff --git a/_blogposts/archive/ffi-overview.mdx b/_blogposts/archive/2019-05-21-ffi-overview.mdx similarity index 100% rename from _blogposts/archive/ffi-overview.mdx rename to _blogposts/archive/2019-05-21-ffi-overview.mdx diff --git a/_blogposts/archive/bucklescript-release-5-0-5.mdx b/_blogposts/archive/2019-06-26-bucklescript-release-5-0-5.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-5-0-5.mdx rename to _blogposts/archive/2019-06-26-bucklescript-release-5-0-5.mdx diff --git a/_blogposts/archive/bucklescript-release-5-1-0.mdx b/_blogposts/archive/2019-08-12-bucklescript-release-5-1-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-5-1-0.mdx rename to _blogposts/archive/2019-08-12-bucklescript-release-5-1-0.mdx diff --git a/_blogposts/archive/bucklescript-release-5-2-0.mdx b/_blogposts/archive/2019-09-23-bucklescript-release-5-2-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-5-2-0.mdx rename to _blogposts/archive/2019-09-23-bucklescript-release-5-2-0.mdx diff --git a/_blogposts/archive/another-encoding.mdx b/_blogposts/archive/2019-10-16-another-encoding.mdx similarity index 100% rename from _blogposts/archive/another-encoding.mdx rename to _blogposts/archive/2019-10-16-another-encoding.mdx diff --git a/_blogposts/archive/whats-new-in-7-pt1.mdx b/_blogposts/archive/2019-11-18-whats-new-in-7-pt1.mdx similarity index 100% rename from _blogposts/archive/whats-new-in-7-pt1.mdx rename to _blogposts/archive/2019-11-18-whats-new-in-7-pt1.mdx diff --git a/_blogposts/archive/whats-new-in-7-pt2.mdx b/_blogposts/archive/2019-11-28-whats-new-in-7-pt2.mdx similarity index 100% rename from _blogposts/archive/whats-new-in-7-pt2.mdx rename to _blogposts/archive/2019-11-28-whats-new-in-7-pt2.mdx diff --git a/_blogposts/archive/bucklescript-release-7-0-2.mdx b/_blogposts/archive/2019-12-20-bucklescript-release-7-0-2.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-7-0-2.mdx rename to _blogposts/archive/2019-12-20-bucklescript-release-7-0-2.mdx diff --git a/_blogposts/archive/bucklescript-release-7-1-0.mdx b/_blogposts/archive/2020-02-04-bucklescript-release-7-1-0.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-7-1-0.mdx rename to _blogposts/archive/2020-02-04-bucklescript-release-7-1-0.mdx diff --git a/_blogposts/archive/union-types-in-bucklescript.mdx b/_blogposts/archive/2020-02-07-union-types-in-bucklescript.mdx similarity index 100% rename from _blogposts/archive/union-types-in-bucklescript.mdx rename to _blogposts/archive/2020-02-07-union-types-in-bucklescript.mdx diff --git a/_blogposts/archive/loading-stdlib-in-memory.mdx b/_blogposts/archive/2020-02-20-loading-stdlib-in-memory.mdx similarity index 100% rename from _blogposts/archive/loading-stdlib-in-memory.mdx rename to _blogposts/archive/2020-02-20-loading-stdlib-in-memory.mdx diff --git a/_blogposts/archive/bucklescript-release-7-2.mdx b/_blogposts/archive/2020-03-12-bucklescript-release-7-2.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-7-2.mdx rename to _blogposts/archive/2020-03-12-bucklescript-release-7-2.mdx diff --git a/_blogposts/archive/generalize-uncurry.mdx b/_blogposts/archive/2020-03-26-generalize-uncurry.mdx similarity index 100% rename from _blogposts/archive/generalize-uncurry.mdx rename to _blogposts/archive/2020-03-26-generalize-uncurry.mdx diff --git a/_blogposts/archive/bucklescript-release-7-3.mdx b/_blogposts/archive/2020-04-13-bucklescript-release-7-3.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-7-3.mdx rename to _blogposts/archive/2020-04-13-bucklescript-release-7-3.mdx diff --git a/_blogposts/archive/a-story-of-exception-encoding.mdx b/_blogposts/archive/2020-05-06-a-story-of-exception-encoding.mdx similarity index 99% rename from _blogposts/archive/a-story-of-exception-encoding.mdx rename to _blogposts/archive/2020-05-06-a-story-of-exception-encoding.mdx index 02f337237..065681d34 100644 --- a/_blogposts/archive/a-story-of-exception-encoding.mdx +++ b/_blogposts/archive/2020-05-06-a-story-of-exception-encoding.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2020-05-06 18:00" +date: "2020-05-06" previewImg: title: New Exception Encoding in BuckleScript description: | diff --git a/_blogposts/archive/state-of-reasonml-org-2020-q2-pt1.mdx b/_blogposts/archive/2020-05-06-state-of-reasonml-org-2020-q2-pt1.mdx similarity index 100% rename from _blogposts/archive/state-of-reasonml-org-2020-q2-pt1.mdx rename to _blogposts/archive/2020-05-06-state-of-reasonml-org-2020-q2-pt1.mdx diff --git a/_blogposts/archive/state-of-reasonml-org-2020-q2-pt2.mdx b/_blogposts/archive/2020-05-11-state-of-reasonml-org-2020-q2-pt2.mdx similarity index 100% rename from _blogposts/archive/state-of-reasonml-org-2020-q2-pt2.mdx rename to _blogposts/archive/2020-05-11-state-of-reasonml-org-2020-q2-pt2.mdx diff --git a/_blogposts/archive/state-of-reasonml-org-2020-q2-pt3.mdx b/_blogposts/archive/2020-05-12-state-of-reasonml-org-2020-q2-pt3.mdx similarity index 100% rename from _blogposts/archive/state-of-reasonml-org-2020-q2-pt3.mdx rename to _blogposts/archive/2020-05-12-state-of-reasonml-org-2020-q2-pt3.mdx diff --git a/_blogposts/archive/a-story-of-lazy-encoding.mdx b/_blogposts/archive/2020-05-15-a-story-of-lazy-encoding.mdx similarity index 99% rename from _blogposts/archive/a-story-of-lazy-encoding.mdx rename to _blogposts/archive/2020-05-15-a-story-of-lazy-encoding.mdx index 96cadbaf9..c5f9e0ac4 100644 --- a/_blogposts/archive/a-story-of-lazy-encoding.mdx +++ b/_blogposts/archive/2020-05-15-a-story-of-lazy-encoding.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2020-05-15 18:00" +date: "2020-05-15" previewImg: title: New Lazy Encoding in BuckleScript description: | diff --git a/_blogposts/archive/state-of-reasonml-org-2020-q2-pt4.mdx b/_blogposts/archive/2020-05-15-state-of-reasonml-org-2020-q2-pt4.mdx similarity index 100% rename from _blogposts/archive/state-of-reasonml-org-2020-q2-pt4.mdx rename to _blogposts/archive/2020-05-15-state-of-reasonml-org-2020-q2-pt4.mdx diff --git a/_blogposts/archive/overview-of-new_encoding.mdx b/_blogposts/archive/2020-06-22-overview-of-new_encoding.mdx similarity index 99% rename from _blogposts/archive/overview-of-new_encoding.mdx rename to _blogposts/archive/2020-06-22-overview-of-new_encoding.mdx index 4cfde8987..4f44a87c8 100644 --- a/_blogposts/archive/overview-of-new_encoding.mdx +++ b/_blogposts/archive/2020-06-22-overview-of-new_encoding.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2020-06-22 18:00" +date: "2020-06-22" previewImg: title: Make generated JavaScript Inline Caching friendly using types in BuckleScript version 8 description: | diff --git a/_blogposts/archive/bucklescript-8-1-new-syntax.mdx b/_blogposts/archive/2020-07-01-bucklescript-8-1-new-syntax.mdx similarity index 100% rename from _blogposts/archive/bucklescript-8-1-new-syntax.mdx rename to _blogposts/archive/2020-07-01-bucklescript-8-1-new-syntax.mdx diff --git a/_blogposts/archive/a-note-on-bucklescripts-future-commitments.mdx b/_blogposts/archive/2020-07-06-a-note-on-bucklescripts-future-commitments.mdx similarity index 100% rename from _blogposts/archive/a-note-on-bucklescripts-future-commitments.mdx rename to _blogposts/archive/2020-07-06-a-note-on-bucklescripts-future-commitments.mdx diff --git a/_blogposts/archive/bucklescript-release-8-1-1.mdx b/_blogposts/archive/2020-07-17-bucklescript-release-8-1-1.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-8-1-1.mdx rename to _blogposts/archive/2020-07-17-bucklescript-release-8-1-1.mdx diff --git a/_blogposts/archive/string-literal-types-in-reason.mdx b/_blogposts/archive/2020-07-28-string-literal-types-in-reason.mdx similarity index 99% rename from _blogposts/archive/string-literal-types-in-reason.mdx rename to _blogposts/archive/2020-07-28-string-literal-types-in-reason.mdx index 928ba40d4..618344aa4 100644 --- a/_blogposts/archive/string-literal-types-in-reason.mdx +++ b/_blogposts/archive/2020-07-28-string-literal-types-in-reason.mdx @@ -1,6 +1,6 @@ --- author: hongbo -date: "2020-07-28 18:00" +date: "2020-07-28" previewImg: title: Introducing string literal types in BuckleScript version 8.2 description: | diff --git a/_blogposts/archive/bucklescript-release-8-2.mdx b/_blogposts/archive/2020-08-03-bucklescript-release-8-2.mdx similarity index 100% rename from _blogposts/archive/bucklescript-release-8-2.mdx rename to _blogposts/archive/2020-08-03-bucklescript-release-8-2.mdx From c733985d070abd577c6b3500b8d9f1fd57472854 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Tue, 11 May 2021 13:39:23 -0700 Subject: [PATCH 2/5] Make apis cater to that --- _blogposts/2020-09-25-release-8-3-2.mdx | 2 +- scripts/test-hrefs.mjs | 7 +- src/Blog.mjs | 2 +- src/Blog.res | 2 +- src/BlogArticle.mjs | 10 +- src/BlogArticle.res | 18 +- src/BlogData.mjs | 314 +++++------------------- src/BlogData.res | 138 +++++------ src/common/BlogApi.mjs | 18 +- src/common/BlogApi.res | 24 +- src/common/BlogApi.resi | 5 +- 11 files changed, 178 insertions(+), 362 deletions(-) diff --git a/_blogposts/2020-09-25-release-8-3-2.mdx b/_blogposts/2020-09-25-release-8-3-2.mdx index 3a798a3ba..b092f53d4 100644 --- a/_blogposts/2020-09-25-release-8-3-2.mdx +++ b/_blogposts/2020-09-25-release-8-3-2.mdx @@ -17,7 +17,7 @@ It's focused on type safety, performance and JS interop. It used to be called Bu npm i bs-platform@8.3.1 ``` -Following the [previous post](/blog/release-8-3-pt1), in this post we will go through +Following the [previous post](/blog/release-8-3), in this post we will go through the enhancement over the build system. ## Performance enhancement diff --git a/scripts/test-hrefs.mjs b/scripts/test-hrefs.mjs index 275bcfaa8..82846610b 100644 --- a/scripts/test-hrefs.mjs +++ b/scripts/test-hrefs.mjs @@ -15,6 +15,7 @@ import fs from "fs"; import urlModule from "url"; import { URL } from 'url'; import {data as blogIndex} from '../src/BlogData.mjs' +import {getSlugFromPath} from '../src/common/BlogApi.mjs' const __dirname = new URL('.', import.meta.url).pathname; @@ -23,9 +24,9 @@ const mapBlogFilePath = path => { if (match) { let relPath = match[1]; - let slugAndFullslug = blogIndex.find(({fullslug}) => fullslug === relPath); - if (slugAndFullslug != null) { - return `./pages/blog/${slugAndFullslug.slug}`; + let fullslug = blogIndex.find((fullslug) => fullslug === relPath); + if (fullslug != null) { + return `./pages/blog/${getSlugFromPath(fullslug)}`; } return path; } diff --git a/src/Blog.mjs b/src/Blog.mjs index e914476d6..ed2de601c 100644 --- a/src/Blog.mjs +++ b/src/Blog.mjs @@ -323,7 +323,7 @@ function getStaticProps(_ctx) { var archived = acc[2]; var malformed = acc[1]; var posts = acc[0]; - var id = postData.slug; + var id = BlogApi.getSlugFromPath(postData.fullslug); var decoded = BlogFrontmatter.decode(postData.frontmatter); if (decoded.TAG === /* Ok */0) { var frontmatter = decoded._0; diff --git a/src/Blog.res b/src/Blog.res index b6240d299..b48d9bd29 100644 --- a/src/Blog.res +++ b/src/Blog.res @@ -372,7 +372,7 @@ let getStaticProps: Next.GetStaticProps.t = _ctx => { postData, ) => { let (posts, malformed, archived) = acc - let id = postData.slug + let id = BlogApi.getSlugFromPath(postData.fullslug) let decoded = BlogFrontmatter.decode(postData.frontmatter) diff --git a/src/BlogArticle.mjs b/src/BlogArticle.mjs index 40c39595d..ecb74ac79 100644 --- a/src/BlogArticle.mjs +++ b/src/BlogArticle.mjs @@ -9,6 +9,7 @@ import * as Util from "./common/Util.mjs"; import * as React from "react"; import * as BlogApi from "./common/BlogApi.mjs"; import * as DateStr from "./common/DateStr.mjs"; +import * as BlogData from "./BlogData.mjs"; import * as Markdown from "./components/Markdown.mjs"; import * as Belt_Array from "rescript/lib/es6/belt_Array.js"; import * as MainLayout from "./layouts/MainLayout.mjs"; @@ -193,7 +194,10 @@ function $$default(props) { function getStaticProps(ctx) { var params = ctx.params; - var fullslug = Belt_Option.getWithDefault(BlogApi.getFullSlug(params.slug), params.slug); + var slug = BlogData.data.find(function (path) { + return BlogApi.getSlugFromPath(path) === params.slug; + }); + var fullslug = slug !== undefined ? slug : params.slug; var props = { fullslug: fullslug }; @@ -204,9 +208,11 @@ function getStaticProps(ctx) { function getStaticPaths(param) { var paths = Belt_Array.map(BlogApi.getAllPosts(undefined), (function (postData) { + var asd = BlogApi.getSlugFromPath(postData.fullslug); + console.log("======", asd); return { params: { - slug: postData.slug + slug: asd } }; })); diff --git a/src/BlogArticle.res b/src/BlogArticle.res index 9ae648e11..ba0c19f7a 100644 --- a/src/BlogArticle.res +++ b/src/BlogArticle.res @@ -225,7 +225,13 @@ let getStaticProps: Next.GetStaticProps.t = ctx => { open Next.GetStaticProps let {params} = ctx - let fullslug = BlogApi.getFullSlug(params.slug)->Belt.Option.getWithDefault(params.slug) + // let fullslug = BlogApi.getFullSlug(params.slug)->Belt.Option.getWithDefault(params.slug) + let fullslug = switch BlogData.data->Js.Array2.find(path => + BlogApi.getSlugFromPath(path) == params.slug + ) { + | None => params.slug + | Some(slug) => slug + } let props = {fullslug: fullslug} let ret = {"props": props} @@ -236,9 +242,13 @@ let getStaticPaths: Next.GetStaticPaths.t = () => { open Next.GetStaticPaths let paths = BlogApi.getAllPosts()->Belt.Array.map(postData => { - params: { - Params.slug: postData.slug, - }, + let asd = BlogApi.getSlugFromPath(postData.fullslug) + Js.log2("======", asd) + { + params: { + Params.slug: asd, + }, + } }) let ret = {paths: paths, fallback: false} Promise.resolve(ret) diff --git a/src/BlogData.mjs b/src/BlogData.mjs index 84597b95c..00ee4e7b9 100644 --- a/src/BlogData.mjs +++ b/src/BlogData.mjs @@ -2,259 +2,71 @@ var data = [ - [ - "release-9-1", - "2021-05-07-release-9-1" - ], - [ - "rescript-association-rebranding", - "2021-03-03-rescript-association-rebranding" - ], - [ - "release-9-0", - "2021-02-09-release-9-0" - ], - [ - "release-8-3-pt2", - "2020-09-25-release-8-3-2" - ], - [ - "release-8-3-pt1", - "2020-09-25-release-8-3" - ], - [ - "new-rescript-logo", - "2020-08-28-new-rescript-logo" - ], - [ - "bucklescript-is-rebranding", - "2020-08-10-bucklescript-is-rebranding" - ], - [ - "a-note-on-bucklescripts-future-commitments", - "archive/a-note-on-bucklescripts-future-commitments" - ], - [ - "a-small-step-for-bucklescript", - "archive/a-small-step-for-bucklescript" - ], - [ - "a-story-of-exception-encoding", - "archive/a-story-of-exception-encoding" - ], - [ - "a-story-of-lazy-encoding", - "archive/a-story-of-lazy-encoding" - ], - [ - "another-encoding", - "archive/another-encoding" - ], - [ - "arity-zero", - "archive/arity-zero" - ], - [ - "bucklescript-8-1-new-syntax", - "archive/bucklescript-8-1-new-syntax" - ], - [ - "bucklescript-release-1-0", - "archive/bucklescript-release-1-0" - ], - [ - "bucklescript-release-1-4-2", - "archive/bucklescript-release-1-4-2" - ], - [ - "bucklescript-release-1-4-3", - "archive/bucklescript-release-1-4-3" - ], - [ - "bucklescript-release-1-5-0", - "archive/bucklescript-release-1-5-0" - ], - [ - "bucklescript-release-1-5-1", - "archive/bucklescript-release-1-5-1" - ], - [ - "bucklescript-release-1-5-2", - "archive/bucklescript-release-1-5-2" - ], - [ - "bucklescript-release-1-7-0", - "archive/bucklescript-release-1-7-0" - ], - [ - "bucklescript-release-1-7-4", - "archive/bucklescript-release-1-7-4" - ], - [ - "bucklescript-release-1-7-5", - "archive/bucklescript-release-1-7-5" - ], - [ - "bucklescript-release-3-0-0", - "archive/bucklescript-release-3-0-0" - ], - [ - "bucklescript-release-3-1-0", - "archive/bucklescript-release-3-1-0" - ], - [ - "bucklescript-release-3-1-4", - "archive/bucklescript-release-3-1-4" - ], - [ - "bucklescript-release-4-0-0-pt1", - "archive/bucklescript-release-4-0-0-pt1" - ], - [ - "bucklescript-release-4-0-0-pt2", - "archive/bucklescript-release-4-0-0-pt2" - ], - [ - "bucklescript-release-4-0-17", - "archive/bucklescript-release-4-0-17" - ], - [ - "bucklescript-release-4-0-8", - "archive/bucklescript-release-4-0-8" - ], - [ - "bucklescript-release-5-0-1", - "archive/bucklescript-release-5-0-1" - ], - [ - "bucklescript-release-5-0-4", - "archive/bucklescript-release-5-0-4" - ], - [ - "bucklescript-release-5-0-5", - "archive/bucklescript-release-5-0-5" - ], - [ - "bucklescript-release-5-0", - "archive/bucklescript-release-5-0" - ], - [ - "bucklescript-release-5-1-0", - "archive/bucklescript-release-5-1-0" - ], - [ - "bucklescript-release-5-2-0", - "archive/bucklescript-release-5-2-0" - ], - [ - "bucklescript-release-6-0", - "archive/bucklescript-release-6-0" - ], - [ - "bucklescript-release-7-0-2", - "archive/bucklescript-release-7-0-2" - ], - [ - "bucklescript-release-7-1-0", - "archive/bucklescript-release-7-1-0" - ], - [ - "bucklescript-release-7-2", - "archive/bucklescript-release-7-2" - ], - [ - "bucklescript-release-7-3", - "archive/bucklescript-release-7-3" - ], - [ - "bucklescript-release-8-1-1", - "archive/bucklescript-release-8-1-1" - ], - [ - "bucklescript-release-8-2", - "archive/bucklescript-release-8-2" - ], - [ - "bucklescript-roadmap-q3-4-2018", - "archive/bucklescript-roadmap-q3-4-2018" - ], - [ - "feature-preview-variadic", - "archive/feature-preview-variadic" - ], - [ - "ffi-overview", - "archive/ffi-overview" - ], - [ - "generalize-uncurry", - "archive/generalize-uncurry" - ], - [ - "loading-stdlib-in-memory", - "archive/loading-stdlib-in-memory" - ], - [ - "overview-of-new_encoding", - "archive/overview-of-new_encoding" - ], - [ - "scalable", - "archive/scalable" - ], - [ - "state-of-reasonml-org-2020-q2-pt1", - "archive/state-of-reasonml-org-2020-q2-pt1" - ], - [ - "state-of-reasonml-org-2020-q2-pt2", - "archive/state-of-reasonml-org-2020-q2-pt2" - ], - [ - "state-of-reasonml-org-2020-q2-pt3", - "archive/state-of-reasonml-org-2020-q2-pt3" - ], - [ - "state-of-reasonml-org-2020-q2-pt4", - "archive/state-of-reasonml-org-2020-q2-pt4" - ], - [ - "string-literal-types-in-reason", - "archive/string-literal-types-in-reason" - ], - [ - "union-types-in-bucklescript", - "archive/union-types-in-bucklescript" - ], - [ - "whats-new-in-7-pt1", - "archive/whats-new-in-7-pt1" - ], - [ - "whats-new-in-7-pt2", - "archive/whats-new-in-7-pt2" - ], - [ - "editor-support-custom-operators-and-more", - "2020-11-17-editor-support-custom-operators-and-more" - ], - [ - "editor-support-release-1-0", - "2020-11-26-editor-support-release-1-0" - ], - [ - "bucklescript-release-8-4", - "2020-12-07-release-8-4" - ] - ].map(function (param) { - return { - slug: param[0], - fullslug: param[1] - }; - }); + "2021-05-07-release-9-1", + "2021-03-03-rescript-association-rebranding", + "2021-02-09-release-9-0", + "2020-09-25-release-8-3-2", + "2020-09-25-release-8-3", + "2020-08-28-new-rescript-logo", + "2020-08-10-bucklescript-is-rebranding", + "archive/2020-07-06-a-note-on-bucklescripts-future-commitments", + "archive/2018-03-13-a-small-step-for-bucklescript", + "archive/2020-05-06-a-story-of-exception-encoding", + "archive/2020-05-15-a-story-of-lazy-encoding", + "archive/2019-10-16-another-encoding", + "archive/2018-11-13-arity-zero", + "archive/2020-07-01-bucklescript-8-1-new-syntax", + "archive/2017-10-01-bucklescript-release-1-0", + "archive/2017-10-02-bucklescript-release-1-4-2", + "archive/2017-10-03-bucklescript-release-1-4-3", + "archive/2017-10-04-bucklescript-release-1-5-0", + "archive/2017-10-05-bucklescript-release-1-5-1", + "archive/2017-10-06-bucklescript-release-1-5-2", + "archive/2017-10-07-bucklescript-release-1-7-0", + "archive/2017-10-08-bucklescript-release-1-7-4", + "archive/2017-10-09-bucklescript-release-1-7-5", + "archive/2018-04-16-bucklescript-release-3-0-0", + "archive/2018-05-21-bucklescript-release-3-1-0", + "archive/2018-05-23-bucklescript-release-3-1-4", + "archive/2018-07-17-bucklescript-release-4-0-0-pt1", + "archive/2018-07-17-bucklescript-release-4-0-0-pt2", + "archive/2019-01-07-bucklescript-release-4-0-17", + "archive/2018-12-05-bucklescript-release-4-0-8", + "archive/2019-04-09-bucklescript-release-5-0-1", + "archive/2019-04-22-bucklescript-release-5-0-4", + "archive/2019-06-26-bucklescript-release-5-0-5", + "archive/2019-03-21-bucklescript-release-5-0", + "archive/2019-08-12-bucklescript-release-5-1-0", + "archive/2019-09-23-bucklescript-release-5-2-0", + "archive/2019-03-31-bucklescript-release-6-0", + "archive/2019-12-20-bucklescript-release-7-0-2", + "archive/2020-02-04-bucklescript-release-7-1-0", + "archive/2020-03-12-bucklescript-release-7-2", + "archive/2020-04-13-bucklescript-release-7-3", + "archive/2020-07-17-bucklescript-release-8-1-1", + "archive/2020-08-03-bucklescript-release-8-2", + "archive/2018-11-19-bucklescript-roadmap-q3-4-2018", + "archive/2019-03-01-feature-preview-variadic", + "archive/2019-05-21-ffi-overview", + "archive/2020-03-26-generalize-uncurry", + "archive/2020-02-20-loading-stdlib-in-memory", + "archive/2020-06-22-overview-of-new_encoding", + "archive/2019-01-11-scalable", + "archive/2020-05-06-state-of-reasonml-org-2020-q2-pt1", + "archive/2020-05-11-state-of-reasonml-org-2020-q2-pt2", + "archive/2020-05-12-state-of-reasonml-org-2020-q2-pt3", + "archive/2020-05-15-state-of-reasonml-org-2020-q2-pt4", + "archive/2020-07-28-string-literal-types-in-reason", + "archive/2020-02-07-union-types-in-bucklescript", + "archive/2019-11-18-whats-new-in-7-pt1", + "archive/2019-11-28-whats-new-in-7-pt2", + "2020-11-17-editor-support-custom-operators-and-more", + "2020-11-26-editor-support-release-1-0", + "2020-12-07-release-8-4" +]; export { data , } -/* data Not a pure module */ +/* No side effect */ diff --git a/src/BlogData.res b/src/BlogData.res index 8e9f38adb..24adc4f58 100644 --- a/src/BlogData.res +++ b/src/BlogData.res @@ -1,75 +1,63 @@ -// fullslug is relative to _blogposts -type pair = {slug: string, fullslug: string} - -let data = Js.Array2.map( - [ - ("release-9-1", "2021-05-07-release-9-1"), - ("rescript-association-rebranding", "2021-03-03-rescript-association-rebranding"), - ("release-9-0", "2021-02-09-release-9-0"), - ("release-8-3-pt2", "2020-09-25-release-8-3-2"), - ("release-8-3-pt1", "2020-09-25-release-8-3"), - ("new-rescript-logo", "2020-08-28-new-rescript-logo"), - ("bucklescript-is-rebranding", "2020-08-10-bucklescript-is-rebranding"), - ( - "a-note-on-bucklescripts-future-commitments", - "archive/a-note-on-bucklescripts-future-commitments", - ), - ("a-small-step-for-bucklescript", "archive/a-small-step-for-bucklescript"), - ("a-story-of-exception-encoding", "archive/a-story-of-exception-encoding"), - ("a-story-of-lazy-encoding", "archive/a-story-of-lazy-encoding"), - ("another-encoding", "archive/another-encoding"), - ("arity-zero", "archive/arity-zero"), - ("bucklescript-8-1-new-syntax", "archive/bucklescript-8-1-new-syntax"), - ("bucklescript-release-1-0", "archive/bucklescript-release-1-0"), - ("bucklescript-release-1-4-2", "archive/bucklescript-release-1-4-2"), - ("bucklescript-release-1-4-3", "archive/bucklescript-release-1-4-3"), - ("bucklescript-release-1-5-0", "archive/bucklescript-release-1-5-0"), - ("bucklescript-release-1-5-1", "archive/bucklescript-release-1-5-1"), - ("bucklescript-release-1-5-2", "archive/bucklescript-release-1-5-2"), - ("bucklescript-release-1-7-0", "archive/bucklescript-release-1-7-0"), - ("bucklescript-release-1-7-4", "archive/bucklescript-release-1-7-4"), - ("bucklescript-release-1-7-5", "archive/bucklescript-release-1-7-5"), - ("bucklescript-release-3-0-0", "archive/bucklescript-release-3-0-0"), - ("bucklescript-release-3-1-0", "archive/bucklescript-release-3-1-0"), - ("bucklescript-release-3-1-4", "archive/bucklescript-release-3-1-4"), - ("bucklescript-release-4-0-0-pt1", "archive/bucklescript-release-4-0-0-pt1"), - ("bucklescript-release-4-0-0-pt2", "archive/bucklescript-release-4-0-0-pt2"), - ("bucklescript-release-4-0-17", "archive/bucklescript-release-4-0-17"), - ("bucklescript-release-4-0-8", "archive/bucklescript-release-4-0-8"), - ("bucklescript-release-5-0-1", "archive/bucklescript-release-5-0-1"), - ("bucklescript-release-5-0-4", "archive/bucklescript-release-5-0-4"), - ("bucklescript-release-5-0-5", "archive/bucklescript-release-5-0-5"), - ("bucklescript-release-5-0", "archive/bucklescript-release-5-0"), - ("bucklescript-release-5-1-0", "archive/bucklescript-release-5-1-0"), - ("bucklescript-release-5-2-0", "archive/bucklescript-release-5-2-0"), - ("bucklescript-release-6-0", "archive/bucklescript-release-6-0"), - ("bucklescript-release-7-0-2", "archive/bucklescript-release-7-0-2"), - ("bucklescript-release-7-1-0", "archive/bucklescript-release-7-1-0"), - ("bucklescript-release-7-2", "archive/bucklescript-release-7-2"), - ("bucklescript-release-7-3", "archive/bucklescript-release-7-3"), - ("bucklescript-release-8-1-1", "archive/bucklescript-release-8-1-1"), - ("bucklescript-release-8-2", "archive/bucklescript-release-8-2"), - ("bucklescript-roadmap-q3-4-2018", "archive/bucklescript-roadmap-q3-4-2018"), - ("feature-preview-variadic", "archive/feature-preview-variadic"), - ("ffi-overview", "archive/ffi-overview"), - ("generalize-uncurry", "archive/generalize-uncurry"), - ("loading-stdlib-in-memory", "archive/loading-stdlib-in-memory"), - ("overview-of-new_encoding", "archive/overview-of-new_encoding"), - ("scalable", "archive/scalable"), - ("state-of-reasonml-org-2020-q2-pt1", "archive/state-of-reasonml-org-2020-q2-pt1"), - ("state-of-reasonml-org-2020-q2-pt2", "archive/state-of-reasonml-org-2020-q2-pt2"), - ("state-of-reasonml-org-2020-q2-pt3", "archive/state-of-reasonml-org-2020-q2-pt3"), - ("state-of-reasonml-org-2020-q2-pt4", "archive/state-of-reasonml-org-2020-q2-pt4"), - ("string-literal-types-in-reason", "archive/string-literal-types-in-reason"), - ("union-types-in-bucklescript", "archive/union-types-in-bucklescript"), - ("whats-new-in-7-pt1", "archive/whats-new-in-7-pt1"), - ("whats-new-in-7-pt2", "archive/whats-new-in-7-pt2"), - ( - "editor-support-custom-operators-and-more", - "2020-11-17-editor-support-custom-operators-and-more", - ), - ("editor-support-release-1-0", "2020-11-26-editor-support-release-1-0"), - ("bucklescript-release-8-4", "2020-12-07-release-8-4"), - ], - ((slug, fullslug)) => {slug: slug, fullslug: fullslug}, -) +let data = [ + "2021-05-07-release-9-1", + "2021-03-03-rescript-association-rebranding", + "2021-02-09-release-9-0", + "2020-09-25-release-8-3-2", + "2020-09-25-release-8-3", + "2020-08-28-new-rescript-logo", + "2020-08-10-bucklescript-is-rebranding", + "archive/2020-07-06-a-note-on-bucklescripts-future-commitments", + "archive/2018-03-13-a-small-step-for-bucklescript", + "archive/2020-05-06-a-story-of-exception-encoding", + "archive/2020-05-15-a-story-of-lazy-encoding", + "archive/2019-10-16-another-encoding", + "archive/2018-11-13-arity-zero", + "archive/2020-07-01-bucklescript-8-1-new-syntax", + "archive/2017-10-01-bucklescript-release-1-0", + "archive/2017-10-02-bucklescript-release-1-4-2", + "archive/2017-10-03-bucklescript-release-1-4-3", + "archive/2017-10-04-bucklescript-release-1-5-0", + "archive/2017-10-05-bucklescript-release-1-5-1", + "archive/2017-10-06-bucklescript-release-1-5-2", + "archive/2017-10-07-bucklescript-release-1-7-0", + "archive/2017-10-08-bucklescript-release-1-7-4", + "archive/2017-10-09-bucklescript-release-1-7-5", + "archive/2018-04-16-bucklescript-release-3-0-0", + "archive/2018-05-21-bucklescript-release-3-1-0", + "archive/2018-05-23-bucklescript-release-3-1-4", + "archive/2018-07-17-bucklescript-release-4-0-0-pt1", + "archive/2018-07-17-bucklescript-release-4-0-0-pt2", + "archive/2019-01-07-bucklescript-release-4-0-17", + "archive/2018-12-05-bucklescript-release-4-0-8", + "archive/2019-04-09-bucklescript-release-5-0-1", + "archive/2019-04-22-bucklescript-release-5-0-4", + "archive/2019-06-26-bucklescript-release-5-0-5", + "archive/2019-03-21-bucklescript-release-5-0", + "archive/2019-08-12-bucklescript-release-5-1-0", + "archive/2019-09-23-bucklescript-release-5-2-0", + "archive/2019-03-31-bucklescript-release-6-0", + "archive/2019-12-20-bucklescript-release-7-0-2", + "archive/2020-02-04-bucklescript-release-7-1-0", + "archive/2020-03-12-bucklescript-release-7-2", + "archive/2020-04-13-bucklescript-release-7-3", + "archive/2020-07-17-bucklescript-release-8-1-1", + "archive/2020-08-03-bucklescript-release-8-2", + "archive/2018-11-19-bucklescript-roadmap-q3-4-2018", + "archive/2019-03-01-feature-preview-variadic", + "archive/2019-05-21-ffi-overview", + "archive/2020-03-26-generalize-uncurry", + "archive/2020-02-20-loading-stdlib-in-memory", + "archive/2020-06-22-overview-of-new_encoding", + "archive/2019-01-11-scalable", + "archive/2020-05-06-state-of-reasonml-org-2020-q2-pt1", + "archive/2020-05-11-state-of-reasonml-org-2020-q2-pt2", + "archive/2020-05-12-state-of-reasonml-org-2020-q2-pt3", + "archive/2020-05-15-state-of-reasonml-org-2020-q2-pt4", + "archive/2020-07-28-string-literal-types-in-reason", + "archive/2020-02-07-union-types-in-bucklescript", + "archive/2019-11-18-whats-new-in-7-pt1", + "archive/2019-11-28-whats-new-in-7-pt2", + "2020-11-17-editor-support-custom-operators-and-more", + "2020-11-26-editor-support-release-1-0", + "2020-12-07-release-8-4", +] diff --git a/src/common/BlogApi.mjs b/src/common/BlogApi.mjs index a0d58ba48..a6b753f9b 100644 --- a/src/common/BlogApi.mjs +++ b/src/common/BlogApi.mjs @@ -11,20 +11,13 @@ import * as Caml_option from "rescript/lib/es6/caml_option.js"; import GrayMatter from "gray-matter"; import * as BlogFrontmatter from "./BlogFrontmatter.mjs"; -function getFullSlug(slug) { - var match = BlogData.data.find(function (param) { - return slug === param.slug; - }); - if (match !== undefined) { - return match.fullslug; - } - +function getSlugFromPath(path) { + return path.replace(/(archive\/)?\d\d\d\d-\d\d-\d\d-/, ""); } function getAllPosts(param) { var postsDirectory = Path.join(Process.cwd(), "./_blogposts"); - return Belt_Array.keepMap(BlogData.data, (function (param) { - var fullslug = param.fullslug; + return Belt_Array.keepMap(BlogData.data, (function (fullslug) { var fullPath = Path.join(postsDirectory, fullslug + ".mdx"); if (!Fs.existsSync(fullPath)) { return ; @@ -33,7 +26,6 @@ function getAllPosts(param) { var match = GrayMatter(fileContents); var archived = fullPath.includes("/archive/"); return { - slug: param.slug, content: match.content, fullslug: fullslug, archived: archived, @@ -58,7 +50,7 @@ function getLatest(maxOpt, baseUrlOpt, param) { var fm$1 = fm._0; var description = Belt_Option.getWithDefault(Caml_option.null_to_opt(fm$1.description), ""); var item_title = fm$1.title; - var item_href = baseUrl + ("/blog/" + next.slug); + var item_href = baseUrl + ("/blog/" + getSlugFromPath(next.fullslug)); var item_pubDate = DateStr.toDate(fm$1.date); var item = { title: item_title, @@ -104,7 +96,7 @@ var RssFeed = { export { getAllPosts , - getFullSlug , + getSlugFromPath , RssFeed , } diff --git a/src/common/BlogApi.res b/src/common/BlogApi.res index 15b7eb55c..f9de5bd65 100644 --- a/src/common/BlogApi.res +++ b/src/common/BlogApi.res @@ -35,24 +35,30 @@ module GrayMatter = { } type postData = { - slug: string, + // slug: string, content: string, fullslug: string, archived: bool, frontmatter: Js.Json.t, } -let getFullSlug = slug => { - switch BlogData.data->Js.Array2.find(({slug: s}) => slug === s) { - | None => None - | Some({fullslug}) => Some(fullslug) - } +let getSlugFromPath = path => { + path->Js.String2.replaceByRe(%re(`/(archive\/)?\d\d\d\d-\d\d-\d\d-/`), "") } + + +// let getFullSlug = slug => { +// switch BlogData.data->Js.Array2.find((path) => slug === s) { +// | None => None +// | Some({fullslug}) => Some(fullslug) +// } +// } + let getAllPosts = () => { let postsDirectory = Node.Path.join2(Node.Process.cwd(), "./_blogposts") - BlogData.data->Belt.Array.keepMap(({slug, fullslug}) => { + BlogData.data->Belt.Array.keepMap((fullslug) => { let fullPath = Node.Path.join2(postsDirectory, fullslug ++ ".mdx") if Node.Fs.existsSync(fullPath) { @@ -64,7 +70,7 @@ let getAllPosts = () => { let archived = Js.String2.includes(fullPath, "/archive/") Some({ - slug: slug, + // slug: slug, fullslug: fullslug, content: content, frontmatter: data, @@ -114,7 +120,7 @@ module RssFeed = { let description = Js.Null.toOption(fm.description)->Belt.Option.getWithDefault("") let item = { title: fm.title, - href: baseUrl ++ ("/blog/" ++ next.slug), + href: baseUrl ++ ("/blog/" ++ getSlugFromPath(next.fullslug)), description: description, pubDate: DateStr.toDate(fm.date), } diff --git a/src/common/BlogApi.resi b/src/common/BlogApi.resi index 0b6ee843a..cc6aa860d 100644 --- a/src/common/BlogApi.resi +++ b/src/common/BlogApi.resi @@ -1,5 +1,5 @@ type postData = { - slug: string, + // slug: string, content: string, fullslug: string, archived: bool, @@ -7,7 +7,8 @@ type postData = { } let getAllPosts: unit => array -let getFullSlug: string => option +// let getFullSlug: string => option +let getSlugFromPath: string => string module RssFeed: { type item = { From 0aa362d275351e8af66e435c92f02c2fc8df0a98 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Tue, 11 May 2021 13:40:50 -0700 Subject: [PATCH 3/5] Clean up --- src/BlogArticle.mjs | 4 +--- src/BlogArticle.res | 11 +++-------- src/common/BlogApi.res | 10 ---------- src/common/BlogApi.resi | 2 -- 4 files changed, 4 insertions(+), 23 deletions(-) diff --git a/src/BlogArticle.mjs b/src/BlogArticle.mjs index ecb74ac79..acdee94e3 100644 --- a/src/BlogArticle.mjs +++ b/src/BlogArticle.mjs @@ -208,11 +208,9 @@ function getStaticProps(ctx) { function getStaticPaths(param) { var paths = Belt_Array.map(BlogApi.getAllPosts(undefined), (function (postData) { - var asd = BlogApi.getSlugFromPath(postData.fullslug); - console.log("======", asd); return { params: { - slug: asd + slug: BlogApi.getSlugFromPath(postData.fullslug) } }; })); diff --git a/src/BlogArticle.res b/src/BlogArticle.res index ba0c19f7a..d0525f05a 100644 --- a/src/BlogArticle.res +++ b/src/BlogArticle.res @@ -225,7 +225,6 @@ let getStaticProps: Next.GetStaticProps.t = ctx => { open Next.GetStaticProps let {params} = ctx - // let fullslug = BlogApi.getFullSlug(params.slug)->Belt.Option.getWithDefault(params.slug) let fullslug = switch BlogData.data->Js.Array2.find(path => BlogApi.getSlugFromPath(path) == params.slug ) { @@ -242,13 +241,9 @@ let getStaticPaths: Next.GetStaticPaths.t = () => { open Next.GetStaticPaths let paths = BlogApi.getAllPosts()->Belt.Array.map(postData => { - let asd = BlogApi.getSlugFromPath(postData.fullslug) - Js.log2("======", asd) - { - params: { - Params.slug: asd, - }, - } + params: { + Params.slug: BlogApi.getSlugFromPath(postData.fullslug), + }, }) let ret = {paths: paths, fallback: false} Promise.resolve(ret) diff --git a/src/common/BlogApi.res b/src/common/BlogApi.res index f9de5bd65..d9a1053a6 100644 --- a/src/common/BlogApi.res +++ b/src/common/BlogApi.res @@ -35,7 +35,6 @@ module GrayMatter = { } type postData = { - // slug: string, content: string, fullslug: string, archived: bool, @@ -46,15 +45,6 @@ let getSlugFromPath = path => { path->Js.String2.replaceByRe(%re(`/(archive\/)?\d\d\d\d-\d\d-\d\d-/`), "") } - - -// let getFullSlug = slug => { -// switch BlogData.data->Js.Array2.find((path) => slug === s) { -// | None => None -// | Some({fullslug}) => Some(fullslug) -// } -// } - let getAllPosts = () => { let postsDirectory = Node.Path.join2(Node.Process.cwd(), "./_blogposts") diff --git a/src/common/BlogApi.resi b/src/common/BlogApi.resi index cc6aa860d..8aeae313c 100644 --- a/src/common/BlogApi.resi +++ b/src/common/BlogApi.resi @@ -1,5 +1,4 @@ type postData = { - // slug: string, content: string, fullslug: string, archived: bool, @@ -7,7 +6,6 @@ type postData = { } let getAllPosts: unit => array -// let getFullSlug: string => option let getSlugFromPath: string => string module RssFeed: { From 0fd6ce209164f08b6c15d6e8b75e7665f8935ebb Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Tue, 11 May 2021 14:03:13 -0700 Subject: [PATCH 4/5] fullslug -> path --- scripts/test-hrefs.mjs | 6 +++--- src/Blog.mjs | 2 +- src/Blog.res | 2 +- src/BlogArticle.mjs | 18 +++++++++--------- src/BlogArticle.res | 18 +++++++++--------- src/BlogArticle.resi | 2 +- src/common/BlogApi.mjs | 8 ++++---- src/common/BlogApi.res | 15 ++++++--------- src/common/BlogApi.resi | 2 +- 9 files changed, 35 insertions(+), 38 deletions(-) diff --git a/scripts/test-hrefs.mjs b/scripts/test-hrefs.mjs index 82846610b..cd5e7087a 100644 --- a/scripts/test-hrefs.mjs +++ b/scripts/test-hrefs.mjs @@ -24,9 +24,9 @@ const mapBlogFilePath = path => { if (match) { let relPath = match[1]; - let fullslug = blogIndex.find((fullslug) => fullslug === relPath); - if (fullslug != null) { - return `./pages/blog/${getSlugFromPath(fullslug)}`; + let path = blogIndex.find((path) => path === relPath); + if (path != null) { + return `./pages/blog/${getSlugFromPath(path)}`; } return path; } diff --git a/src/Blog.mjs b/src/Blog.mjs index ed2de601c..e0c1e6e23 100644 --- a/src/Blog.mjs +++ b/src/Blog.mjs @@ -323,7 +323,7 @@ function getStaticProps(_ctx) { var archived = acc[2]; var malformed = acc[1]; var posts = acc[0]; - var id = BlogApi.getSlugFromPath(postData.fullslug); + var id = BlogApi.getSlugFromPath(postData.path); var decoded = BlogFrontmatter.decode(postData.frontmatter); if (decoded.TAG === /* Ok */0) { var frontmatter = decoded._0; diff --git a/src/Blog.res b/src/Blog.res index b48d9bd29..c3ad78119 100644 --- a/src/Blog.res +++ b/src/Blog.res @@ -372,7 +372,7 @@ let getStaticProps: Next.GetStaticProps.t = _ctx => { postData, ) => { let (posts, malformed, archived) = acc - let id = BlogApi.getSlugFromPath(postData.fullslug) + let id = BlogApi.getSlugFromPath(postData.path) let decoded = BlogFrontmatter.decode(postData.frontmatter) diff --git a/src/BlogArticle.mjs b/src/BlogArticle.mjs index acdee94e3..013dcf7c9 100644 --- a/src/BlogArticle.mjs +++ b/src/BlogArticle.mjs @@ -110,9 +110,9 @@ function BlogArticle$BlogHeader(Props) { } function $$default(props) { - var fullslug = props.fullslug; - var module_ = require("../_blogposts/" + (fullslug + ".mdx")); - var archived = fullslug.startsWith("archive/"); + var path = props.path; + var module_ = require("../_blogposts/" + (path + ".mdx")); + var archived = path.startsWith("archive/"); var component = module_.default; var fm = BlogFrontmatter.decode(frontmatter(component)); var children = React.createElement(component, {}); @@ -183,7 +183,7 @@ function $$default(props) { children: null }, React.createElement("h2", { className: "font-bold text-gray-95 text-28 mb-2" - }, "Could not parse file '_blogposts/" + (fullslug + ".mdx'")), React.createElement("p", undefined, "The content of this blog post will be displayed as soon as all\n required frontmatter data has been added."), React.createElement("p", { + }, "Could not parse file '_blogposts/" + (path + ".mdx'")), React.createElement("p", undefined, "The content of this blog post will be displayed as soon as all\n required frontmatter data has been added."), React.createElement("p", { className: "font-bold mt-4" }, "Errors:"), fm._0)); } @@ -194,12 +194,12 @@ function $$default(props) { function getStaticProps(ctx) { var params = ctx.params; - var slug = BlogData.data.find(function (path) { - return BlogApi.getSlugFromPath(path) === params.slug; + var slug = BlogData.data.find(function (path2) { + return BlogApi.getSlugFromPath(path2) === params.slug; }); - var fullslug = slug !== undefined ? slug : params.slug; + var path = slug !== undefined ? slug : params.slug; var props = { - fullslug: fullslug + path: path }; return Promise.resolve({ props: props @@ -210,7 +210,7 @@ function getStaticPaths(param) { var paths = Belt_Array.map(BlogApi.getAllPosts(undefined), (function (postData) { return { params: { - slug: BlogApi.getSlugFromPath(postData.fullslug) + slug: BlogApi.getSlugFromPath(postData.path) } }; })); diff --git a/src/BlogArticle.res b/src/BlogArticle.res index d0525f05a..300c4b88d 100644 --- a/src/BlogArticle.res +++ b/src/BlogArticle.res @@ -22,7 +22,7 @@ module Params = { type t = {slug: string} } -type props = {fullslug: string} +type props = {path: string} module BlogComponent = { type t = {default: React.component<{.}>} @@ -124,11 +124,11 @@ module BlogHeader = { } let default = (props: props) => { - let {fullslug} = props + let {path} = props - let module_ = BlogComponent.require("../_blogposts/" ++ (fullslug ++ ".mdx")) + let module_ = BlogComponent.require("../_blogposts/" ++ (path ++ ".mdx")) - let archived = Js.String2.startsWith(fullslug, "archive/") + let archived = Js.String2.startsWith(path, "archive/") let component = module_.default @@ -207,7 +207,7 @@ let default = (props: props) => {

- {React.string("Could not parse file '_blogposts/" ++ (fullslug ++ ".mdx'"))} + {React.string("Could not parse file '_blogposts/" ++ (path ++ ".mdx'"))}

{React.string("The content of this blog post will be displayed as soon as all @@ -225,14 +225,14 @@ let getStaticProps: Next.GetStaticProps.t = ctx => { open Next.GetStaticProps let {params} = ctx - let fullslug = switch BlogData.data->Js.Array2.find(path => - BlogApi.getSlugFromPath(path) == params.slug + let path = switch BlogData.data->Js.Array2.find(path2 => + BlogApi.getSlugFromPath(path2) == params.slug ) { | None => params.slug | Some(slug) => slug } - let props = {fullslug: fullslug} + let props = {path: path} let ret = {"props": props} Promise.resolve(ret) } @@ -242,7 +242,7 @@ let getStaticPaths: Next.GetStaticPaths.t = () => { let paths = BlogApi.getAllPosts()->Belt.Array.map(postData => { params: { - Params.slug: BlogApi.getSlugFromPath(postData.fullslug), + Params.slug: BlogApi.getSlugFromPath(postData.path), }, }) let ret = {paths: paths, fallback: false} diff --git a/src/BlogArticle.resi b/src/BlogArticle.resi index 54cc3a3a9..1ac7abf5c 100644 --- a/src/BlogArticle.resi +++ b/src/BlogArticle.resi @@ -2,7 +2,7 @@ module Params: { type t = {slug: string} } -type props = {fullslug: string} +type props = {path: string} let default: props => React.element diff --git a/src/common/BlogApi.mjs b/src/common/BlogApi.mjs index a6b753f9b..54d7334f3 100644 --- a/src/common/BlogApi.mjs +++ b/src/common/BlogApi.mjs @@ -17,8 +17,8 @@ function getSlugFromPath(path) { function getAllPosts(param) { var postsDirectory = Path.join(Process.cwd(), "./_blogposts"); - return Belt_Array.keepMap(BlogData.data, (function (fullslug) { - var fullPath = Path.join(postsDirectory, fullslug + ".mdx"); + return Belt_Array.keepMap(BlogData.data, (function (path) { + var fullPath = Path.join(postsDirectory, path + ".mdx"); if (!Fs.existsSync(fullPath)) { return ; } @@ -27,7 +27,7 @@ function getAllPosts(param) { var archived = fullPath.includes("/archive/"); return { content: match.content, - fullslug: fullslug, + path: path, archived: archived, frontmatter: match.data }; @@ -50,7 +50,7 @@ function getLatest(maxOpt, baseUrlOpt, param) { var fm$1 = fm._0; var description = Belt_Option.getWithDefault(Caml_option.null_to_opt(fm$1.description), ""); var item_title = fm$1.title; - var item_href = baseUrl + ("/blog/" + getSlugFromPath(next.fullslug)); + var item_href = baseUrl + ("/blog/" + getSlugFromPath(next.path)); var item_pubDate = DateStr.toDate(fm$1.date); var item = { title: item_title, diff --git a/src/common/BlogApi.res b/src/common/BlogApi.res index d9a1053a6..9636b837f 100644 --- a/src/common/BlogApi.res +++ b/src/common/BlogApi.res @@ -10,9 +10,7 @@ Every filename within _blogposts must be unique, even when nested in different directories. The filename will be sluggified, that means that e.g. - for the filepath "_blogposts/compiler/my-post.mdx": - - slug = "my-post" - - fullslug = "compiler/my-post" + for the filepath "_blogposts/compiler/2021-03-12-my-post.mdx", slug = "my-post" The reason for the flat hierarchy is that we want to keep a flat URL hierarchy with `https://rescript-lang.org/blog/[some-slug]`, without carrying @@ -36,7 +34,7 @@ module GrayMatter = { type postData = { content: string, - fullslug: string, + path: string, archived: bool, frontmatter: Js.Json.t, } @@ -48,8 +46,8 @@ let getSlugFromPath = path => { let getAllPosts = () => { let postsDirectory = Node.Path.join2(Node.Process.cwd(), "./_blogposts") - BlogData.data->Belt.Array.keepMap((fullslug) => { - let fullPath = Node.Path.join2(postsDirectory, fullslug ++ ".mdx") + BlogData.data->Belt.Array.keepMap((path) => { + let fullPath = Node.Path.join2(postsDirectory, path ++ ".mdx") if Node.Fs.existsSync(fullPath) { let fileContents = Node.Fs.readFileSync(fullPath, #utf8) @@ -60,8 +58,7 @@ let getAllPosts = () => { let archived = Js.String2.includes(fullPath, "/archive/") Some({ - // slug: slug, - fullslug: fullslug, + path: path, content: content, frontmatter: data, archived: archived, @@ -110,7 +107,7 @@ module RssFeed = { let description = Js.Null.toOption(fm.description)->Belt.Option.getWithDefault("") let item = { title: fm.title, - href: baseUrl ++ ("/blog/" ++ getSlugFromPath(next.fullslug)), + href: baseUrl ++ ("/blog/" ++ getSlugFromPath(next.path)), description: description, pubDate: DateStr.toDate(fm.date), } diff --git a/src/common/BlogApi.resi b/src/common/BlogApi.resi index 8aeae313c..f417eae1d 100644 --- a/src/common/BlogApi.resi +++ b/src/common/BlogApi.resi @@ -1,6 +1,6 @@ type postData = { content: string, - fullslug: string, + path: string, archived: bool, frontmatter: Js.Json.t, } From 8f6640a1fffc4e67d441f0ad9648f222d41566ed Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Tue, 11 May 2021 14:06:22 -0700 Subject: [PATCH 5/5] Update readmes --- README.md | 9 +-------- pages/blogpost-guide.mdx | 13 +++++++------ 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e49e3bcb1..961ad882c 100644 --- a/README.md +++ b/README.md @@ -151,14 +151,7 @@ NODE_ENV=production npx postcss styles/main.css -o test.css ## Writing Blog Posts -In case you are a blog author, please refer to our [guide on writing blog -posts](https://rescript-lang.org/blogpost-guide). - -**Quick-takeaways:** - -- Blogposts are located in `_blogposts` -- Author metadata is located in `data/blog_authors.mjs` -- Make sure to follow the file naming rules +In case you are a blog author, please refer to our [guide on writing blog posts](https://rescript-lang.org/blogpost-guide). ### Contributing diff --git a/pages/blogpost-guide.mdx b/pages/blogpost-guide.mdx index d1195dfc9..88e0d5739 100644 --- a/pages/blogpost-guide.mdx +++ b/pages/blogpost-guide.mdx @@ -13,8 +13,7 @@ Open the [localhost:3000/blog](/blog) page to see the blog page. ## Create a new file -Blogposts are located in the `./_blogposts` directory. -Please stick to the following filename convention to maintain a natural sort order on every file-system: +Blogposts are located in the `./_blogposts` directory. File name starts with the date to maintain a natural sort order: ``` _blogposts/YYYY-MM-DD-[title].mdx @@ -28,14 +27,16 @@ touch _blogposts/2020-01-30-my-new-blog-post.mdx ### Map the file to a URL -Open the `src/BlogData.res` file and add a new mapping like this: +Open the `src/BlogData.res` file and add the path to `data`: ```res -("my-new-blog-post", "2020-01-30-my-new-blog-post.mdx") +let data = [ + // ... + "2020-01-30-my-new-blog-post", + // ... +] ``` -The first item describes the final slug (e.g. `/blog/my-new-blog-post`), while the second defines the relative filepath within the `_blogposts` directory, without the extension. - Save your changes within and refresh your browser within [/blog](/blog). You should now see a warning for some malformed frontmatter data. Let's fix this! ## Add Frontmatter Data