Skip to content

Commit c60e560

Browse files
♻️ Use front matter for handlebars
1 parent 5f10cdb commit c60e560

File tree

8 files changed

+19
-27
lines changed

8 files changed

+19
-27
lines changed

content/configuration/article-2.md

-7
This file was deleted.

content/configuration/index.md

-7
This file was deleted.

content/configuration/page-1.md

-3
This file was deleted.

content/getting-started/index.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
emoji: 🛠️
33
---
44

5-
# Configuration
5+
# Getting started
66

7-
This will bring about some options
7+
Oswald Labs (formerly Oswald Foundation) is an India and Netherlands-based accessibility technology company that builds products for individuals with disabilities. It specializes in enterprise web accessibility, offers smartphone apps, and also runs a startup accelerator. It was established in 2016 by Anand Chowdhary, Nishant Gadihoke and Mahendra Raghuwanshi after their product, Oswald Extension, won an event at the AngelHack hackathon in New Delhi.
8+
9+
In an interview with The Huffington Post, Chowdhary said that he believes "Oswald \[Labs] can enable a Web 4.0, a web centered around accessibility and equality". Oswald Labs is named in honor of Oswald Berkhan, the German physician who first identified dyslexia in 1881.
10+
11+
Text from Wikipedia

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@staart/site",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"module": "dist/module.js",
55
"main": "dist/index.js",
66
"bin": "./dist/index.js",

src/generator.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { SitemapStream, streamToPromise } from "sitemap";
2828
import { StaartSiteConfig } from "./interfaces";
2929
import { getLastCommit, getGitHubRepoUrl } from "./github";
3030
import { parse as yaml } from "yaml";
31+
import frontMatter from "front-matter";
32+
import { FrontMatter } from "./interfaces";
3133

3234
export const getTemplate = async () => {
3335
const result = await cached<string>("template", async () => {
@@ -280,6 +282,7 @@ const generatePage = async (path: string, content: string) => {
280282
}" target="_blank">Edit on GitHub</a></p>`;
281283
}
282284
const template = compile(await getTemplate());
285+
const attributes = frontMatter<FrontMatter>(content).attributes;
283286
const data: { [index: string]: any } = {
284287
...(await getData()),
285288
content:
@@ -294,7 +297,8 @@ const generatePage = async (path: string, content: string) => {
294297
: `${await getTitle(content)} · ${(await getSiteMeta(
295298
"title",
296299
"name"
297-
)) || "Staart Site"}`
300+
)) || "Staart Site"}`,
301+
...attributes
298302
};
299303
for await (const key of Object.keys(data)) {
300304
if (typeof data[key] === "string")

src/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
<meta property="og:title" content="{{ metaTitle }}">
3232
{{#if description }}<meta name="description" content="{{ description }}">{{/if}}
3333
{{#if description }}<meta itemprop="description" content="{{ description }}">{{/if}}
34-
{{#if heroImage }}<meta itemprop="image" content="{{ heroImage }}">{{/if}}
34+
{{#if seoImage }}<meta itemprop="image" content="{{ seoImage }}">{{/if}}
3535
{{#if twitterPublisher }}<meta name="twitter:site" content="@{{ twitterPublisher }}">{{/if}}
3636
{{#if description }}<meta name="twitter:description" content="{{ description }}">{{/if}}
3737
{{#if twitterCreator }}<meta name="twitter:creator" content="@{{ twitterCreator }}">{{/if}}
38-
{{#if heroImage }}<meta name="twitter:image:src" content="{{ heroImage }}">{{/if}}
38+
{{#if seoImage }}<meta name="twitter:image:src" content="{{ seoImage }}">{{/if}}
3939
{{#if canonical }}<meta property="og:url" content="{{ canonical }}">{{/if}}
40-
{{#if heroImage }}<meta property="og:image" content="{{ heroImage }}">{{/if}}
40+
{{#if seoImage }}<meta property="og:image" content="{{ seoImage }}">{{/if}}
4141
{{#if description }}<meta property="og:description" content="{{ description }}">{{/if}}
4242
{{#if title }}<meta property="og:site_name" content="{{ title }}">{{/if}}
4343
{{#if publishedTime }}<meta property="article:published_time" content="{{ publishedTime }}">{{/if}}

src/interfaces.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export interface StaartSiteConfig {
3838
}
3939

4040
export interface FrontMatter {
41-
title?: string;
42-
emoji?: string;
43-
seoImage?: string;
41+
title: string;
42+
emoji: string;
43+
seoImage: string;
44+
[index: string]: string;
4445
}

0 commit comments

Comments
 (0)