Skip to content

Commit c05c202

Browse files
authored
Add new blog post (#78)
* Add new blog post * Fix build?
1 parent 890ea22 commit c05c202

File tree

13 files changed

+200
-6
lines changed

13 files changed

+200
-6
lines changed

packages/cdm-content/content.ts

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { readdirSync, readFileSync, statSync } from "fs";
22
import { extname, join, posix } from "path";
33
import matter from "gray-matter";
44
import markdownToHtml from "./markdownToHtml";
5-
import { fileURLToPath } from "url";
65

76
export type BaseModel = {
87
slug: string;
@@ -24,19 +23,48 @@ export type Author = {
2423
avatar?: string;
2524
}
2625

27-
export function getContentPaths(directoryPath: string, ext: string[]) {
28-
return readdirSync(directoryPath)
26+
export function getContentPaths(directoryPath: string, ext: string[], baseDir: string = '') {
27+
const res = readdirSync(directoryPath)
28+
29+
return res
30+
.reduce((paths: string[], path: string) => {
31+
const fullPath = join(directoryPath, path)
32+
33+
if (statSync(fullPath).isDirectory()) {
34+
const subPaths = getContentPaths(fullPath, ext, path)
35+
36+
paths = paths.concat(subPaths)
37+
}
38+
else if (!paths.includes(path)) {
39+
paths.push(join(baseDir, path))
40+
}
41+
42+
return paths
43+
}, [])
2944
.filter(f => ext.includes(extname(f)))
3045
}
3146

3247
export async function getContentBySlug<ContentShape extends BaseModel>(slug: string, directoryPath: string, ext: string, basePath: string = '', fields: string[] = []): Promise<BaseModel> {
3348
const realSlug = posix.normalize(join('/', basePath, slug)
3449
.replace(ext, '')
3550
.replace(`\\`, '/')
51+
.replace('/index', '')
3652
);
3753
const realPath = slug.replace(basePath, '')
3854
.replace(ext, '');
39-
const fullPath = join(directoryPath, `${realPath}`) + ext;
55+
56+
let fullPath: string;
57+
try {
58+
const object = await statSync(join(directoryPath, realPath))
59+
60+
if (object.isDirectory()) {
61+
fullPath = join(directoryPath, realPath, '/index') + ext
62+
}
63+
}
64+
catch {
65+
fullPath = join(directoryPath, realPath) + ext
66+
}
67+
4068
const fileContents = readFileSync(fullPath, 'utf8')
4169
const fileMeta = statSync(fullPath);
4270
let data: any;
@@ -117,6 +145,6 @@ export async function getAllContent<ContentShape extends BaseModel>(directory: s
117145
return content
118146
.filter(c => c !== null)
119147
.sort((post1, post2) => post1?.updated ?
120-
(post1?.updated > post2?.updated ? -1 : 1) :
121-
(post1?.created > post2?.created ? -1 : 1)) as ContentShape[]
148+
(new Date(post2?.updated).getUTCMilliseconds() > new Date(post1?.updated).getUTCMilliseconds() ? 1 : -1) :
149+
(new Date(post2?.created).getUTCMilliseconds() > new Date(post1?.created).getUTCMilliseconds()) ? 1 : -1) as ContentShape[]
122150
}
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
title: HEY! It's Gmail
3+
description: Re-creating the core value propositions of HEY.com, but in Gmail
4+
createdBy: chris
5+
updatedBy: chris
6+
created: 2022-04-01
7+
---
8+
## We didn’t reinvent the wheel, only email.
9+
10+
That's what Basecamp, the creators of [HEY.com], say they've done for email. Quite a divisive statement, and for some, it's true.
11+
12+
I for one am one of those people. The mental model HEY provides for managing my email is refreshing, simple, and most of all, _relaxing_. It takes the "hair on fire" out of the email inbox, and makes "inbox zero" unecessary.
13+
14+
But here's the catch -- what if you've got email you just can't put through HEY? I for one have work email that lives in Google workspaces and routing it through HEY would be a huge violation of our security regulations. So I just gave Gmail the power to say, HEY.
15+
16+
## It all starts with a Yes or No
17+
18+
![](/uploads/2022-04-01-hey-its-gmail/screener.png)
19+
20+
When someone emails your @hey.com address for the very first time, they don’t get straight through, they land in The Screener. This is where you decide if you want to hear from them or not. **Yes** and they’re in, **No** and you’ll never hear from them again. It’s consent-based email, where you’re in control.
21+
22+
So how do I make this happen in Gmail? Using the _multiple inboxes_ feature, which allows you to display custom sections in your inbox that correspong to _labels_ attached to your emails. Sound complicated? Don't worry, I'll break it down.
23+
24+
| | |
25+
| ---------------- | ---------------- |
26+
| ![](/uploads/2022-04-01-hey-its-gmail/imbox.png) | ![](/uploads/2022-04-01-hey-its-gmail/inbox.png) |
27+
28+
With this multiple inbox setup, we've retrofitted gmail to:
29+
30+
1. Display _unread_ screened emails in a collapsible section, similar to the Imbox. The emails you've said **Yes** to but have yet to read or sort.
31+
2. Display _read_ screened emails in a collapsible section, similar to the Imbox. This is so you can keep them hidden unless you need to go back to them.
32+
3. Display _unscreened_ emails in your inbox. These are all of the emails you haven't said **Yes** or **No** to.
33+
34+
To set this up, open the settings menu (the cog in the top right corner) and then select "Customize" under "Multiple inboxes":
35+
36+
![](/uploads/2022-04-01-hey-its-gmail/settings.png)
37+
38+
Configure your settings to match the following:
39+
40+
![](inbox-settings.png)
41+
42+
1. Inbox type as "Multiple inboxes"
43+
2. Section 1 as `label:Screened Senders is:unread`, with the section name `New for you`
44+
3. Section 2 as `label:Screened Senders is:read`, with the section name `Previously seen`
45+
4. Set your maximum page size as desired. The default is 9, which I found way too low.
46+
5. Multiple inbox position as "Above the inbox". That way your unread, screened messages are top of mind.
47+
48+
### The Imbox
49+
50+
With Gmail, the yes and the no aren't as clean and tidy as HEY. But it still works!
51+
52+
#### The Yes
53+
54+
To say **Yes**, we'll use the "filter messages like these" feature of gmail, which auto-generates filter criteria for incoming email.
55+
56+
Select an email, and then open up the additional options and select "Filter messages like these":
57+
58+
![](/uploads/2022-04-01-hey-its-gmail/yes-1.png)
59+
60+
Then, select "Create filter" in the modal that opens:
61+
62+
![](/uploads/2022-04-01-hey-its-gmail/yes-2.png)
63+
64+
For our final step, we will select the options:
65+
66+
![](/uploads/2022-04-01-hey-its-gmail/yes-3.png)
67+
68+
- "Skip the inbox", because we're screening these automatically out of the unsorted inbox
69+
- Create or apply the label `Screeened Senders` to screen in incoming messages like these
70+
- (Optional) Apply the filter to all existing matching conversations so they all retroactively are screened in. If you don't enable this, only new mail will be screened in.
71+
72+
Then select "Create filter" and watch the magic happen!
73+
74+
#### The No
75+
76+
To say **No**, we'll go through a similar process:
77+
78+
Select an email, and then open up the additional options and select "Filter messages like these":
79+
80+
![](/uploads/2022-04-01-hey-its-gmail/yes-1.png)
81+
82+
Then, select "Create filter" in the modal that opens:
83+
84+
![](/uploads/2022-04-01-hey-its-gmail/yes-2.png)
85+
86+
For our final step, we will select the options:
87+
88+
![](/uploads/2022-04-01-hey-its-gmail/no.png)
89+
90+
- "Skip the inbox", because we're screening these automatically out of the unsorted inbox. These emails are "screened out" because they go to the archive and don't receive the "Screen Senders" label.
91+
92+
Then select "Create filter" and watch the magic happen!
93+
94+
### The Feed
95+
96+
![The Feed is for your casual, whenever reads. The Feed turns your newsletters, promotional emails, and long-reads into a browsable, casual newsfeed. Just scroll, everything’s open already. See something you like? Click it and read the whole thing right in place.](the-feed.png)
97+
98+
To set up The Feed, we'll screen in senders, but apply a "The Paper Trail" label instead of a "Screened Senders" label:
99+
100+
![](/uploads/2022-04-01-hey-its-gmail/yes-1.png)
101+
102+
Then, select "Create filter" in the modal that opens:
103+
104+
![](/uploads/2022-04-01-hey-its-gmail/yes-2.png)
105+
106+
For our final step, we will select the options:
107+
108+
![](/uploads/2022-04-01-hey-its-gmail/yes-3.png)
109+
110+
- "Skip the inbox", because we're screening these automatically out of the unsorted inbox
111+
- Create or apply the label `The Feed` to screen in incoming messages like these
112+
- (Optional) Apply the filter to all existing matching conversations so they all retroactively are screened in. If you don't enable this, only new mail will be screened in.
113+
114+
Then select "Create filter" and watch the magic happen!
115+
116+
### Re-screening to The Feed
117+
118+
Re-screening (i.e, if you've previously screened a sender) to requires you to [change your filters](#changing-managing-or-removing-filters).
119+
120+
### The Paper Trail
121+
122+
![The Paper Trail is where your transactions go. HEY’s Paper Trail keeps the transactional email clutter in one place, out of your face. When you need to refer to a receipt, order confirmation, service notification, etc. just head over to The Paper Trail and it’ll be waiting for you.](the-paper-trail.png)
123+
124+
To set up The Paper Trail, we'll screen in senders, but apply a "The Paper Trail" label instead of a "Screened Senders" label:
125+
126+
![](/uploads/2022-04-01-hey-its-gmail/yes-1.png)
127+
128+
Then, select "Create filter" in the modal that opens:
129+
130+
![](/uploads/2022-04-01-hey-its-gmail/yes-2.png)
131+
132+
For our final step, we will select the options:
133+
134+
![](/uploads/2022-04-01-hey-its-gmail/yes-3.png)
135+
136+
- "Skip the inbox", because we're screening these automatically out of the unsorted inbox
137+
- Create or apply the label `The Paper Trail` to screen in incoming messages like these
138+
- (Optional) Apply the filter to all existing matching conversations so they all retroactively are screened in. If you don't enable this, only new mail will be screened in.
139+
140+
Then select "Create filter" and watch the magic happen!
141+
142+
### Re-screening to The Paper Trail
143+
144+
Re-screening (i.e, if you've previously screened a sender) to requires you to [change your filters](#changing-managing-or-removing-filters).
145+
146+
### Changing, Managing, or Removing Filters
147+
148+
If you ever decide your screening logic is not what you'd like, you can review all of the filters you've created by opening up the settings menu (the cog in the top right corner) and selecting "See all settings".
149+
150+
On the subsequent page, navigate to "Filters and blocked addresses". All of your filters will be listed, and you can edit, delete, or export your filters.
151+
152+
Keep in mind that filters _stack_ in _no paticular order_. If you want to unscreen a previously screened sender, it's best to edit that filter to _not_ add the "Screened Senders" label, which will ensure all future mail is screened out.
153+
154+
## Coming soon...
155+
156+
HEY has many other useful features, and Gmail _can_ achieve most of them. A follow up post will detail more ways to get the same value when using HEY just isn't an option, such as:
157+
158+
- Reply later and set aside
159+
- Clips: storing parts of emails for quick-access later
160+
- Using multiple email accounts in one inbox
161+
- Sticky notes and private notes to self
162+
- Find files / file management
163+
- Renaming email subjects
164+
- Merging threads
165+
- Ignoring threads
166+
- Autorespond when you're away
848 KB
Loading
534 KB
Loading
284 KB
Loading
119 KB
Loading
74 KB
Loading
412 KB
Loading
602 KB
Loading
960 KB
Loading

0 commit comments

Comments
 (0)