work on events

This commit is contained in:
2023-05-26 16:45:29 -07:00
parent 2dd300f4dc
commit 7297f9cd7a
9 changed files with 205 additions and 88 deletions

View File

@@ -8,19 +8,20 @@ import { load_from_dir } from './fs';
import { ColorTheme } from '@doc-utils/color-themes';
import { ThemeGroups } from './build-files';
import { ChangeFreq } from './build-files/sitemap';
import { DateTime } from 'luxon';
export interface Context {
env?: Record<string, string>;
page?: FrontMatter;
base_url: string;
page_url: string;
page_published: ContextTime;
page_updated: ContextTime;
site_title: string;
author: AuthorConfig | AuthorConfig[];
event?: {
start: ContextTime;
end: ContextTime;
zone: `${string}/${string}`;
event?: ContextEvent | ContextEvent[];
event_series?: {
start?: ContextTime;
end?: ContextTime;
};
icons: Record<string, string>;
themes: ColorTheme[];
@@ -39,6 +40,22 @@ export interface ContextTime {
html: string;
}
export interface ContextEvent {
title?: string;
start?: ContextTime;
end?: ContextTime;
time_zone?: `${string}/${string}`;
location?: ContextLocation;
}
export interface ContextLocation {
description?: string;
lat?: string;
long?: string;
// todo: represent this better?
address?: string;
}
export interface FrontMatter {
skip?: boolean;
layout?: string;
@@ -48,23 +65,33 @@ export interface FrontMatter {
author?: string | string[];
rss?: RSSFrontmatter;
sitemap?: SitemapFrontmatter;
event?: EventFrontmatter;
event?: EventFrontmatter | EventFrontmatter[];
[key: string]: unknown;
}
interface SitemapFrontmatter {
export interface SitemapFrontmatter {
skip?: boolean;
change_freq?: ChangeFreq;
priority?: number;
}
interface EventFrontmatter {
export interface EventFrontmatter {
title?: string;
start?: string;
end?: string;
zone?: `${string}/${string}`;
time_zone?: `${string}/${string}`;
location?: FrontMatterLocation;
}
interface RSSFrontmatter {
export interface FrontMatterLocation {
description?: string;
lat?: string;
long?: string;
// todo: represent this better?
address?: string;
}
export interface RSSFrontmatter {
skip?: boolean;
}