Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Commit 9025111

Browse files
author
Colin McDonnell
committed
Updated sponsorship
1 parent 7f1436f commit 9025111

File tree

8 files changed

+144
-12
lines changed

8 files changed

+144
-12
lines changed

FUNDING.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
github: vriad
1+
# github: vriad

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<p align="center">
55
A developer blog starter for 2020. <br/>Next.js + React + TypeScript + <br/>Markdown + syntax highlighting + SEO + <br/>RSS generation
66
</p>
7-
87
<p align="center">
98
if you're happy and you know it, star this repo
109
</p>
@@ -31,7 +30,13 @@ A dev blog starter for 2020.
3130

3231
Read more about the motivation + design behind Devii at [https://vriad.com/blog/devii](https://vriad.com/blog/devii).
3332

34-
## Get started
33+
# Sponsor
34+
35+
Big thanks to this week's Devii sponsor! Do us a favor and see what they have to offer.
36+
37+
<a href="https://tracking.gitads.io/?repo=zod"><img src="https://images.gitads.io/zod" alt="GitAds"/></a>
38+
39+
# Get started
3540

3641
This repo contains the code for [https://devii.dev](https://devii.dev).
3742

@@ -245,7 +250,7 @@ To get started customizing, check out the source code of `index.tsx` (the home p
245250

246251
Head to the GitHub repo to get started: [https://github.com/vriad/devii](https://github.com/vriad/devii). If you like this project, leave a ⭐️star⭐️ to help more people find Devii 😎
247252

248-
## CLI
253+
# CLI
249254

250255
### `yarn dev`
251256

@@ -258,3 +263,10 @@ Creates an optimized build of your site. Equivalent to `next build`.
258263
### `yarn export`
259264

260265
Exports your site to static files. All files are written to `/out`. Use your static file hosting service of choice (Firebase Hosting, Amazon S3, Vercel) to deploy your site. Equivalent to `next export`.
266+
267+
# Sponsorship
268+
269+
Devii is being sponsored by the following tool; please help to support us by taking a look and signing up to a free trial:
270+
<a href="https://tracking.gitads.io/?repo=devii">
271+
<img src="https://images.gitads.io/devii" alt="GitAds"/>
272+
</a>

loader.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export type PostData = {
99
description?: string;
1010
canonicalUrl?: string;
1111
published: boolean;
12-
datePublished?: number;
12+
datePublished: number;
1313
author?: string;
1414
authorPhoto?: string;
1515
authorTwitter?: string;
@@ -45,8 +45,9 @@ export const mdToPost = (file: RawFile): PostData => {
4545
content: metadata.content,
4646
};
4747

48-
if (!post.title) throw new Error(`Missing: title.`);
49-
if (!post.content) throw new Error(`Missing: content.`);
48+
if (!post.title) throw new Error(`Missing required field: title.`);
49+
if (!post.content) throw new Error(`Missing required field: content.`);
50+
if (!post.datePublished) throw new Error(`Missing required field: datePublished.`);
5051

5152
return post as PostData;
5253
};
@@ -68,5 +69,7 @@ export const loadPost = async (path: string): Promise<PostData> => {
6869
};
6970

7071
export const loadBlogPosts = async (): Promise<PostData[]> => {
71-
return await (await loadMarkdownFiles(`blog/*.md`)).map(mdToPost);
72+
return await (await loadMarkdownFiles(`blog/*.md`)).map(mdToPost)
73+
.filter((p) => p.published)
74+
.sort((a, b) => (b.datePublished || 0) - (a.datePublished || 0));;
7275
};

md/blog/dan-abramov.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ tags:
88
authorPhoto: /profile.jpg
99
bannerPhoto: /danabramov.png
1010
thumbnailPhoto: /danabramov_thumb.png
11+
canonicalUrl: https://devii.dev/blog/dan-abramov
1112
---
1213

1314
Dan Abramov knows about Devii!

md/blog/devii.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ tags:
1010
authorPhoto: /profile.jpg
1111
bannerPhoto: /brook.jpg
1212
thumbnailPhoto: /brook.jpg
13+
canonicalUrl: https://devii.dev/blog/devii
1314
---
1415

1516
This page is built with Devii! Check out the source code for this under `/md/blog/test.md`.

md/blog/the-ultimate-tech-stack.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
---
22
title: Choosing a tech stack for my personal dev blog in 2020
3-
date: 1590463136775
43
published: true
4+
datePublished: 1590463136775
55
author: Colin McDonnell
66
authorTwitter: vriad
77
authorPhoto: https://vriad.com/colin_square_small.jpg
8-
tags: Static Site Generators, React, Next.js
8+
tags:
9+
- Static Site Generators
10+
- React
11+
- Next.js
912
thumbnailPhoto: https://vriad.com/pancakes_thumb.jpeg
1013
bannerPhoto: https://vriad.com/pancakes.jpeg
1114
canonicalUrl: https://vriad.com/essays/devii

public/rss.xml

Lines changed: 109 additions & 2 deletions
Large diffs are not rendered by default.

rssUtil.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ import { PostData } from './loader';
99
// import glob from 'glob';
1010

1111
export const generateRSS = async (posts: PostData[]) => {
12+
13+
posts.map((post) => {
14+
if (!post.canonicalUrl) throw new Error('Missing canonicalUrl. A canonical URL is required for RSS feed generation. If you don\'t care about RSS, uncomment `generateRSS(posts)` at the bottom of index.tsx.');
15+
return post;
16+
})
1217
const feed = new RSS({
1318
title: config.siteName,
1419
description: config.siteDescription,

0 commit comments

Comments
 (0)