Skip to content

Commit bd1a6e0

Browse files
Revert "Add community blog and first blog post (#973)"
This reverts commit df7a9ac.
1 parent df7a9ac commit bd1a6e0

File tree

9 files changed

+29
-252
lines changed

9 files changed

+29
-252
lines changed

_blogposts/community/2025-03-03-what-can-i-do-with-rescript.mdx

-142
This file was deleted.

pages/blog/community.js

-7
This file was deleted.

pages/community/overview.mdx

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ News are broadcasted on this site's blog, on Bluesky and X. Some extra, less imp
2323

2424
## Articles
2525

26-
- [Community Blog](/blog/community)
27-
- [Getting rid of your dead code in ReScript](https://dev.to/zth/getting-rid-of-your-dead-code-in-rescript-3mba)
26+
- [Getting rid of your dead code in ReScript](https://dev.to/zth/getting-rid-of-your-dead-code-in-rescript-3mba)
2827
- [Speeding up ReScript compilation using interface files](https://dev.to/zth/speeding-up-rescript-compilation-using-interface-files-4fgn)
2928
- Articles in [awesome-rescript](https://github.com/fhammerschmidt/awesome-rescript#readme)
3029

src/Blog.res

+6-20
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ module Badge = {
4141
}
4242

4343
type category =
44-
| Official
45-
| Community
44+
| /** Actually only unarchived */ All
4645
| Archived
4746

4847
module CategorySelector = {
4948
@react.component
5049
let make = (~selected: category) => {
51-
let tabs = [Official, Community, Archived]
50+
let tabs = [All, Archived]
5251

5352
<div className="text-16 w-full flex items-center justify-between text-gray-60">
5453
{tabs
@@ -57,8 +56,7 @@ module CategorySelector = {
5756
let isActive = selected == tab
5857
let text = (tab :> string)
5958
let href = switch tab {
60-
| Official => "/blog"
61-
| Community => "/blog/community"
59+
| All => "/blog"
6260
| Archived => "/blog/archived"
6361
}
6462
let className =
@@ -172,10 +170,7 @@ module FeatureCard = {
172170
<div>
173171
<a
174172
className="hover:text-gray-60"
175-
href={switch author.social {
176-
| X(handle) => "https://x.com/" ++ handle
177-
| Bluesky(handle) => "https://bsky.app/profile/" ++ handle
178-
}}
173+
href={"https://x.com/" ++ author.xHandle}
179174
rel="noopener noreferrer">
180175
{React.string(author.fullname)}
181176
</a>
@@ -302,26 +297,17 @@ let default = (props: props): React.element => {
302297
let getStaticProps_All: Next.GetStaticProps.t<props, params> = async _ctx => {
303298
let props = {
304299
posts: BlogApi.getLivePosts(),
305-
category: Official,
300+
category: All,
306301
}
307302

308303
{"props": props}
309304
}
310305

311306
let getStaticProps_Archived: Next.GetStaticProps.t<props, params> = async _ctx => {
312307
let props = {
313-
posts: BlogApi.getSpecialPosts("archive"),
308+
posts: BlogApi.getArchivedPosts(),
314309
category: Archived,
315310
}
316311

317312
{"props": props}
318313
}
319-
320-
let getStaticProps_Community: Next.GetStaticProps.t<props, params> = async _ctx => {
321-
let props = {
322-
posts: BlogApi.getSpecialPosts("community"),
323-
category: Community,
324-
}
325-
326-
{"props": props}
327-
}

src/Blog.resi

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ let defaultPreviewImg: string
33
type params
44
type props
55

6-
type category = Official | Community | Archived
6+
type category = All | Archived
77

88
let default: props => React.element
99

1010
let getStaticProps_All: Next.GetStaticProps.t<props, params>
1111
let getStaticProps_Archived: Next.GetStaticProps.t<props, params>
12-
let getStaticProps_Community: Next.GetStaticProps.t<props, params>

src/BlogArticle.res

+2-31
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ module AuthorBox = {
3939
<div className="w-10 h-10 bg-berry-40 block rounded-full mr-3"> authorImg </div>
4040
<div className="body-sm">
4141
<a
42-
href={switch author.social {
43-
| X(handle) => "https://x.com/" ++ handle
44-
| Bluesky(handle) => "https://bsky.app/profile/" ++ handle
45-
}}
42+
href={"https://x.com/" ++ author.xHandle}
4643
className="hover:text-gray-80"
4744
rel="noopener noreferrer">
4845
{React.string(author.fullname)}
@@ -63,7 +60,6 @@ module BlogHeader = {
6360
~category: option<string>=?,
6461
~description: option<string>,
6562
~articleImg: option<string>,
66-
~originalSrc: option<(string, string)>,
6763
) => {
6864
let date = DateStr.toDate(date)
6965

@@ -92,17 +88,6 @@ module BlogHeader = {
9288
</div>
9389
}
9490
)}
95-
{switch originalSrc {
96-
| None => React.null
97-
| Some("", _) => React.null
98-
| Some(_, "") => React.null
99-
| Some(url, title) =>
100-
<div className="mt-1 mb-8">
101-
<a className="body-sm no-underline text-fire hover:underline" href=url>
102-
{React.string(`Originally posted on ${title}`)}
103-
</a>
104-
</div>
105-
}}
10691
<div className="flex flex-col md:flex-row mb-12">
10792
{Array.map(authors, author =>
10893
<div
@@ -162,17 +147,7 @@ let default = (props: props) => {
162147
: React.null
163148

164149
let content = switch fm {
165-
| Ok({
166-
date,
167-
author,
168-
co_authors,
169-
title,
170-
description,
171-
articleImg,
172-
previewImg,
173-
originalSrc,
174-
originalSrcUrl,
175-
}) =>
150+
| Ok({date, author, co_authors, title, description, articleImg, previewImg}) =>
176151
<div className="w-full">
177152
<Meta
178153
siteName="ReScript Blog"
@@ -188,10 +163,6 @@ let default = (props: props) => {
188163
title
189164
description={description->Null.toOption}
190165
articleImg={articleImg->Null.toOption}
191-
originalSrc={switch (originalSrcUrl->Null.toOption, originalSrc->Null.toOption) {
192-
| (Some(url), Some(title)) => Some(url, title)
193-
| _ => None
194-
}}
195166
/>
196167
</div>
197168
<div className="flex justify-center">

src/common/BlogApi.res

+9-25
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ type post = {
3939
}
4040

4141
let blogPathToSlug = path => {
42-
path
43-
->String.replaceRegExp(%re(`/^(archive\/)?\d\d\d\d-\d\d-\d\d-(.+)\.mdx$/`), "$2")
44-
->String.replaceRegExp(%re(`/^(community\/)?\d\d\d\d-\d\d-\d\d-(.+)\.mdx$/`), "$2")
42+
path->String.replaceRegExp(%re(`/^(archive\/)?\d\d\d\d-\d\d-\d\d-(.+)\.mdx$/`), "$2")
4543
}
4644

4745
let mdxFiles = dir => {
@@ -51,7 +49,6 @@ let mdxFiles = dir => {
5149
let getAllPosts = () => {
5250
let postsDirectory = Node.Path.join2(Node.Process.cwd(), "_blogposts")
5351
let archivedPostsDirectory = Node.Path.join2(postsDirectory, "archive")
54-
let communityPostsDirectory = Node.Path.join2(postsDirectory, "community")
5552

5653
let nonArchivedPosts = mdxFiles(postsDirectory)->Array.map(path => {
5754
let {GrayMatter.data: data} =
@@ -79,20 +76,7 @@ let getAllPosts = () => {
7976
}
8077
})
8178

82-
let communityPosts = mdxFiles(communityPostsDirectory)->Array.map(path => {
83-
let {GrayMatter.data: data} =
84-
Node.Path.join2(communityPostsDirectory, path)->Node.Fs.readFileSync->GrayMatter.matter
85-
switch BlogFrontmatter.decode(data) {
86-
| Error(msg) => Exn.raiseError(msg)
87-
| Ok(d) => {
88-
path: Node.Path.join2("community", path),
89-
frontmatter: d,
90-
archived: false,
91-
}
92-
}
93-
})
94-
95-
Array.concatMany(nonArchivedPosts, [archivedPosts, communityPosts])->Array.toSorted((a, b) =>
79+
Array.concat(nonArchivedPosts, archivedPosts)->Array.toSorted((a, b) =>
9680
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
9781
)
9882
}
@@ -118,24 +102,24 @@ let getLivePosts = () => {
118102
)
119103
}
120104

121-
let getSpecialPosts = directory => {
105+
let getArchivedPosts = () => {
122106
let postsDirectory = Node.Path.join2(Node.Process.cwd(), "_blogposts")
123-
let specialPostsDirectory = Node.Path.join2(postsDirectory, directory)
107+
let archivedPostsDirectory = Node.Path.join2(postsDirectory, "archive")
124108

125-
let specialPosts = mdxFiles(specialPostsDirectory)->Array.map(path => {
109+
let archivedPosts = mdxFiles(archivedPostsDirectory)->Array.map(path => {
126110
let {GrayMatter.data: data} =
127-
Node.Path.join2(specialPostsDirectory, path)->Node.Fs.readFileSync->GrayMatter.matter
111+
Node.Path.join2(archivedPostsDirectory, path)->Node.Fs.readFileSync->GrayMatter.matter
128112
switch BlogFrontmatter.decode(data) {
129113
| Error(msg) => Exn.raiseError(msg)
130114
| Ok(d) => {
131-
path: Node.Path.join2(directory, path),
115+
path: Node.Path.join2("archive", path),
132116
frontmatter: d,
133-
archived: directory === "archive",
117+
archived: true,
134118
}
135119
}
136120
})
137121

138-
specialPosts->Array.toSorted((a, b) =>
122+
archivedPosts->Array.toSorted((a, b) =>
139123
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
140124
)
141125
}

src/common/BlogApi.resi

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ type post = {
66

77
let getAllPosts: unit => array<post>
88
let getLivePosts: unit => array<post>
9-
let getSpecialPosts: string => array<post>
9+
let getArchivedPosts: unit => array<post>
1010
let blogPathToSlug: string => string
1111

1212
module RssFeed: {

0 commit comments

Comments
 (0)