Skip to content

Commit 7bbe1ea

Browse files
committed
add community blog
1 parent 67ecba3 commit 7bbe1ea

File tree

9 files changed

+93
-29
lines changed

9 files changed

+93
-29
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
author: josh-derocher-vlk
3+
date: "2025-01-01"
4+
previewImg: /static/blog/compiler_release_11_1.jpg
5+
title: Test Post
6+
badge: release
7+
description: |
8+
Unleashing ReScript from React
9+
---

pages/blog/community.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import BlogRes from "src/Blog.mjs";
2+
3+
export { getStaticProps_Community as getStaticProps } from "src/Blog.mjs";
4+
5+
export default function Blog(props) {
6+
return <BlogRes {...props} />
7+
}

pages/community/overview.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,19 @@ canonical: "/community/overview"
1010

1111
- This website
1212
- [Twitter](https://twitter.com/rescriptlang)
13+
- [BlueSky](https://bsky.app/profile/rescript-lang.org)
1314
- [Forum](https://forum.rescript-lang.org)
1415
- [ReScript GitHub Org](https://github.com/rescript-lang/)
1516
- [ReScript Online Meetup on Guild](https://guild.host/rescript-online-meetup)
1617
- [ReScript Online Meetup YouTube Channel](https://www.youtube.com/@ReScriptOnlineMeetup)
1718

18-
News are broadcasted on this site's blog and on Twitter. Some extra, less important news are also posted on the forum's [Announcements category](https://forum.rescript-lang.org/c/announcements/).
19+
News are broadcasted on this site's blog, Twitter, and BlueSky. Some extra, less important news are also posted on the forum's [Announcements category](https://forum.rescript-lang.org/c/announcements/).
1920

2021
**We don't use any other channel to communicate officially**. Any announcement made by users on Reddit, Discord, Medium and others don't necessarily represent our intent.
2122

2223
## Articles
2324

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

src/Blog.res

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ module Badge = {
4141
}
4242

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

4748
module CategorySelector = {
4849
@react.component
4950
let make = (~selected: category) => {
50-
let tabs = [All, Archived]
51+
let tabs = [Official, Community, Archived]
5152

5253
<div className="text-16 w-full flex items-center justify-between text-gray-60">
5354
{tabs
@@ -56,7 +57,8 @@ module CategorySelector = {
5657
let isActive = selected == tab
5758
let text = (tab :> string)
5859
let href = switch tab {
59-
| All => "/blog"
60+
| Official => "/blog"
61+
| Community => "community"
6062
| Archived => "/blog/archived"
6163
}
6264
let className =
@@ -170,7 +172,10 @@ module FeatureCard = {
170172
<div>
171173
<a
172174
className="hover:text-gray-60"
173-
href={"https://twitter.com/" ++ author.twitter}
175+
href={switch author.social {
176+
| Twitter(handle) => "https://twitter.com/" ++ handle
177+
| BlueSky(handle) => "https://bsky.app/profile/" ++ handle
178+
}}
174179
rel="noopener noreferrer">
175180
{React.string(author.fullname)}
176181
</a>
@@ -297,17 +302,26 @@ let default = (props: props): React.element => {
297302
let getStaticProps_All: Next.GetStaticProps.t<props, params> = async _ctx => {
298303
let props = {
299304
posts: BlogApi.getLivePosts(),
300-
category: All,
305+
category: Official,
301306
}
302307

303308
{"props": props}
304309
}
305310

306311
let getStaticProps_Archived: Next.GetStaticProps.t<props, params> = async _ctx => {
307312
let props = {
308-
posts: BlogApi.getArchivedPosts(),
313+
posts: BlogApi.getSpecialPosts("archive"),
309314
category: Archived,
310315
}
311316

312317
{"props": props}
313318
}
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

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

6-
type category = All | Archived
6+
type category = Official | Community | 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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ module AuthorBox = {
3838
<div className="w-10 h-10 bg-berry-40 block rounded-full mr-3"> authorImg </div>
3939
<div className="body-sm">
4040
<a
41-
href={"https://twitter.com/" ++ author.twitter}
41+
href={switch author.social {
42+
| Twitter(handle) => "https://twitter.com/" ++ handle
43+
| BlueSky(handle) => "https://bsky.app/profile/" ++ handle
44+
}}
4245
className="hover:text-gray-80"
4346
rel="noopener noreferrer">
4447
{React.string(author.fullname)}
@@ -205,7 +208,7 @@ let default = (props: props) => {
205208
let getStaticProps: Next.GetStaticProps.t<props, Params.t> = async ctx => {
206209
open Next.GetStaticProps
207210
let {params} = ctx
208-
211+
Js.Console.log(params)
209212
let path = switch BlogApi.getAllPosts()->Js.Array2.find(({path}) =>
210213
BlogApi.blogPathToSlug(path) == params.slug
211214
) {

src/common/BlogApi.res

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ type post = {
3939
}
4040

4141
let blogPathToSlug = path => {
42-
path->Js.String2.replaceByRe(%re(`/^(archive\/)?\d\d\d\d-\d\d-\d\d-(.+)\.mdx$/`), "$2")
42+
path
43+
->Js.String2.replaceByRe(%re(`/^(archive\/)?\d\d\d\d-\d\d-\d\d-(.+)\.mdx$/`), "$2")
44+
->Js.String2.replaceByRe(%re(`/^(community\/)?\d\d\d\d-\d\d-\d\d-(.+)\.mdx$/`), "$2")
4345
}
4446

4547
let mdxFiles = dir => {
@@ -49,6 +51,7 @@ let mdxFiles = dir => {
4951
let getAllPosts = () => {
5052
let postsDirectory = Node.Path.join2(Node.Process.cwd(), "_blogposts")
5153
let archivedPostsDirectory = Node.Path.join2(postsDirectory, "archive")
54+
let communityPostsDirectory = Node.Path.join2(postsDirectory, "community")
5255

5356
let nonArchivedPosts = mdxFiles(postsDirectory)->Js.Array2.map(path => {
5457
let {GrayMatter.data: data} =
@@ -76,7 +79,23 @@ let getAllPosts = () => {
7679
}
7780
})
7881

79-
Js.Array2.concat(nonArchivedPosts, archivedPosts)->Js.Array2.sortInPlaceWith((a, b) => {
82+
let communityPosts = mdxFiles(communityPostsDirectory)->Js.Array2.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) => Js.Exn.raiseError(msg)
87+
| Ok(d) => {
88+
path: Node.Path.join2("community", path),
89+
frontmatter: d,
90+
archived: false,
91+
}
92+
}
93+
})
94+
95+
Js.Array2.concatMany(
96+
nonArchivedPosts,
97+
[archivedPosts, communityPosts],
98+
)->Js.Array2.sortInPlaceWith((a, b) => {
8099
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
81100
})
82101
}
@@ -102,24 +121,24 @@ let getLivePosts = () => {
102121
})
103122
}
104123

105-
let getArchivedPosts = () => {
124+
let getSpecialPosts = directory => {
106125
let postsDirectory = Node.Path.join2(Node.Process.cwd(), "_blogposts")
107-
let archivedPostsDirectory = Node.Path.join2(postsDirectory, "archive")
126+
let specialPostsDirectory = Node.Path.join2(postsDirectory, directory)
108127

109-
let archivedPosts = mdxFiles(archivedPostsDirectory)->Js.Array2.map(path => {
128+
let specialPosts = mdxFiles(specialPostsDirectory)->Js.Array2.map(path => {
110129
let {GrayMatter.data: data} =
111-
Node.Path.join2(archivedPostsDirectory, path)->Node.Fs.readFileSync->GrayMatter.matter
130+
Node.Path.join2(specialPostsDirectory, path)->Node.Fs.readFileSync->GrayMatter.matter
112131
switch BlogFrontmatter.decode(data) {
113132
| Error(msg) => Js.Exn.raiseError(msg)
114133
| Ok(d) => {
115-
path: Node.Path.join2("archive", path),
134+
path: Node.Path.join2(directory, path),
116135
frontmatter: d,
117-
archived: true,
136+
archived: directory === "archive",
118137
}
119138
}
120139
})
121140

122-
archivedPosts->Js.Array2.sortInPlaceWith((a, b) => {
141+
specialPosts->Js.Array2.sortInPlaceWith((a, b) => {
123142
String.compare(Node.Path.basename(b.path), Node.Path.basename(a.path))
124143
})
125144
}

src/common/BlogApi.resi

Lines changed: 1 addition & 1 deletion
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 getArchivedPosts: unit => array<post>
9+
let getSpecialPosts: string => array<post>
1010
let blogPathToSlug: string => string
1111

1212
module RssFeed: {

src/common/BlogFrontmatter.res

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
type social = Twitter(string) | BlueSky(string)
2+
13
type author = {
24
username: string,
35
fullname: string,
46
role: string,
57
imgUrl: string,
6-
twitter: string,
8+
social: social,
79
}
810

911
let authors = [
@@ -12,56 +14,63 @@ let authors = [
1214
fullname: "Hongbo Zhang",
1315
role: "Compiler & Build System",
1416
imgUrl: "https://pbs.twimg.com/profile_images/1369548222314598400/E2y46vrB_400x400.jpg",
15-
twitter: "bobzhang1988",
17+
social: Twitter("bobzhang1988"),
1618
},
1719
{
1820
username: "chenglou",
1921
fullname: "Cheng Lou",
2022
role: "Syntax & Tools",
2123
imgUrl: "https://pbs.twimg.com/profile_images/554199709909131265/Y5qUDaCB_400x400.jpeg",
22-
twitter: "_chenglou",
24+
social: Twitter("_chenglou"),
2325
},
2426
{
2527
username: "maxim",
2628
fullname: "Maxim Valcke",
2729
role: "Syntax Lead",
2830
imgUrl: "https://pbs.twimg.com/profile_images/970271048812974080/Xrr8Ob6J_400x400.jpg",
29-
twitter: "_binary_search",
31+
social: Twitter("_binary_search"),
3032
},
3133
{
3234
username: "ryyppy",
3335
fullname: "Patrick Ecker",
3436
role: "Documentation",
3537
imgUrl: "https://pbs.twimg.com/profile_images/1388426717006544897/B_a7D4GF_400x400.jpg",
36-
twitter: "ryyppy",
38+
social: Twitter("ryyppy"),
3739
},
3840
{
3941
username: "rickyvetter",
4042
fullname: "Ricky Vetter",
4143
role: "ReScript & React",
4244
imgUrl: "https://pbs.twimg.com/profile_images/541111032207273984/DGsZmmfr_400x400.jpeg",
43-
twitter: "rickyvetter",
45+
social: Twitter("rickyvetter"),
4446
},
4547
{
4648
username: "made_by_betty",
4749
fullname: "Bettina Steinbrecher",
4850
role: "Brand / UI / UX",
4951
imgUrl: "https://pbs.twimg.com/profile_images/1366785342704136195/3IGyRhV1_400x400.jpg",
50-
twitter: "made_by_betty",
52+
social: Twitter("made_by_betty"),
5153
},
5254
{
5355
username: "rescript-team",
5456
fullname: "ReScript Team",
5557
role: "Core Development",
5658
imgUrl: "https://pbs.twimg.com/profile_images/1358354824660541440/YMKNWE1V_400x400.png",
57-
twitter: "rescriptlang",
59+
social: Twitter("rescriptlang"),
5860
},
5961
{
6062
username: "rescript-association",
6163
fullname: "ReScript Association",
6264
role: "Foundation",
6365
imgUrl: "https://pbs.twimg.com/profile_images/1045362176117100545/MioTQoTp_400x400.jpg",
64-
twitter: "ReScriptAssoc",
66+
social: Twitter("ReScriptAssoc"),
67+
},
68+
{
69+
username: "josh-derocher-vlk",
70+
fullname: "Josh Derocher-Vlk",
71+
role: "Community Member",
72+
imgUrl: "https://cdn.bsky.app/img/avatar/plain/did:plc:erifxn5qcos2zrxvogse5y5s/bafkreif6v7lrtz24vi5ekumkiwg7n7js55coekszduwhjegfmdopd7tqmi@webp",
73+
social: BlueSky("vlkpack.com"),
6574
},
6675
]
6776

0 commit comments

Comments
 (0)