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

Commit c03727e

Browse files
author
Colin McDonnell
committed
Added files
1 parent 9025111 commit c03727e

File tree

3 files changed

+99
-0
lines changed

3 files changed

+99
-0
lines changed

md/features.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
It may not look like much, but Devii does a lot out of the box.
2+
3+
**Markdown loading and rendering**: Using Next.js dynamic imports, you can load Markdown files and pass them into your Next.js pages as props. Easy peasy.
4+
5+
**TypeScript + React**: Markdown is great for text-heavy, non-interactive content. For everything else, you'll want something a little more expressive. Devii makes it easy to mix Markdown and React on the same page. Just load your Markdown files with dynamic imports, pass it into your component as a prop, and render it with the `Markdown.tsx` component.
6+
7+
**Built-in support for blogs**: Devii provides a utility for parsing Markdown blog posts with frontmatter metadata into a structured TypeScript object. Supported tags include: `title`, `subtitle`, `datePublished`, `tags`, `description`, `canonicalUrl`, `author`, `authorPhoto`, `authorTwitter`, `bannerPhoto`, and `thumbnailPhoto`
8+
9+
**Medium-inspired styles**: The Markdown components (`Markdown.tsx`) contains default styles inspired by Medium.
10+
11+
**Google Analytics**: Just add your Google Analytics ID (e.g. 'UA-999999999-1') to `globals.ts` and the appropriate snippet will be automatically added to every page.
12+
13+
**RSS feed generation**: An RSS feed is auto-generated from your blog post feed.
14+
15+
**SEO best practices**: Every blog post page automatically populated meta tags based on the post metadata. This includes a `title` tag, `meta` tags, `og:` tags, Twitter metadata, and a `link` tag containing the canonical URL.
16+
17+
**GitHub-style code blocks**: with syntax highlighting powered by [react-syntax-highlighter](https://github.com/conorhastings/react-syntax-highlighter). Works out-of-the-box for all programming languages. Just use Markdown's triple backtick syntax with a "language identifier", [just like GitHub](https://help.github.com/en/github/writing-on-github/creating-and-highlighting-code-blocks).
18+
19+
**Static generation**: you can generate a fully static version of your site using `yarn build && yarn export`. Powered by Next.js.
20+
21+
**Zero magic**: You can view and modify every aspect of the site. If you're looking for a starting point, start modifying `index.tsx` (the home page), `BlogPost.tsx` (the blog post template), and `Markdown.tsx` (the Markdown component). And of course you can add entirely new pages/components as well!

md/introduction.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
## Welcome to Devii
2+
3+
This site is entirely built with Devii! In fact, the
4+
[GitHub repo for Devii](https://github.com/vriad/devii) contains the
5+
code for the site you're looking at now.
6+
7+
Devii doesn't try to be a fully functional blog out of the box. After cloning/forking the repo, you'll need to delete the contents of `index.tsx` (the page you're reading now!) and implement your own homepage. Devii makes it easier — for instance, you can access a list of all your blog posts in `props.posts` — but you still have to build the site you're imagining in your mind's eye.
8+
9+
And that's the point! After you clone/fork it, look through this code to learn how Devii works. Then rip out what you don't like, customize everything else, and build your own tools and components on top of the foundation Devii provides!
10+
11+
Devii was designed to place _zero restrictions_ on what your site can be or become. You can use any React component or styling library, pull in data from third-party APIs, even implement user accounts. Your personal website is the online manifestation of you. Don't compromise.

sitemap.ts

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
export const sitemap = '';
2+
import glob from 'glob';
3+
import { getStaticPaths as getBlogPaths } from './pages/blog/[blog]';
4+
// import { getStaticPaths as getBlogPaths } from './pages/blog/[blog]';
5+
6+
export const generateSitemap = async () => {
7+
const pagesDir = './pages/**/*.*';
8+
const posts = await glob.sync(pagesDir);
9+
10+
const pagePaths = posts
11+
.filter((path) => !path.includes('['))
12+
.filter((path) => !path.includes('/_'))
13+
.map((path) => path.slice(1));
14+
15+
const blogPaths = await getBlogPaths().paths;
16+
// console.log(blogs);
17+
18+
// console.log(JSON.stringify(pages, null, 2));
19+
// const templates = posts
20+
// .filter((path) => path.includes('['))
21+
// .filter((path) => path.includes(']'))
22+
// .filter((path) => !path.includes('/_')).map(path => `.${path}`);
23+
24+
// console.log(JSON.stringify(templates, null, 2));
25+
26+
// for (const temp of templates) {
27+
// console.log(temp);
28+
// const imports = await import(`${temp}`);
29+
// console.log(imports);
30+
// const { getStaticPaths } = await import(`${temp}`);
31+
// console.log(getStaticPaths);
32+
// }
33+
34+
const sitemap = `
35+
<?xml version="1.0" encoding="UTF-8"?>
36+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
37+
<url>
38+
<loc>https://vriad.com</loc>
39+
<lastmod>2020-06-01</lastmod>
40+
</url>
41+
${[...pagePaths, ...blogPaths].map((path) => {
42+
const item = [`<url>`];
43+
item.push(` <loc>https://vriad.com${path}</loc>`);
44+
item.push(` <lastmod>2020-06-01</lastmod>`);
45+
return [`<url>`];
46+
})}
47+
48+
<url>
49+
<loc>https://vriad.com/essay/zod</loc>
50+
<lastmod>2020-03-28</lastmod>
51+
</url>
52+
<url>
53+
<loc>https://vriad.com/essay/devii</loc>
54+
<lastmod>2020-05-28</lastmod>
55+
</url>
56+
<url>
57+
<loc>https://vriad.com/essay/say-no-to-emotion-core</loc>
58+
<lastmod>2020-06-05</lastmod>
59+
</url>
60+
<url>
61+
<loc>https://vriad.com/essay/css-in-js-is-inevitable</loc>
62+
<lastmod>2020-06-07</lastmod>
63+
</url>
64+
</urlset>`;
65+
66+
return sitemap;
67+
};

0 commit comments

Comments
 (0)