mathiassm
Safe HaskellNone
LanguageGHC2024

MathiasSM.Content

Description

Typed views of the content files: posts and pages (front matter)

Synopsis

Documentation

data Language Source #

Language a page is written in

Constructors

En 
Es 
Ja 

languageCode :: Language -> String Source #

The code used in front matter and in lang attributes

data Post Source #

What a post (blog, creative-writing) needs to be published

Instances

Instances details
Show Post Source # 
Instance details

Defined in MathiasSM.Content

Methods

showsPrec :: Int -> Post -> ShowS #

show :: Post -> String #

showList :: [Post] -> ShowS #

Eq Post Source # 
Instance details

Defined in MathiasSM.Content

Methods

(==) :: Post -> Post -> Bool #

(/=) :: Post -> Post -> Bool #

data NavEntry Source #

A page that appears in the site menu (`nav: label`, `navOrder: n` in its front matter)

Constructors

NavEntry 

Fields

Instances

Instances details
Show NavEntry Source # 
Instance details

Defined in MathiasSM.Content

Eq NavEntry Source # 
Instance details

Defined in MathiasSM.Content

isDraft :: Metadata -> Bool Source #

Whether an item is marked `draft: true`, and so left out of the site

isHidden :: Env -> Metadata -> Bool Source #

Whether a draft item is hidden from this build (dev shows drafts, prod hides them)

isIndex :: Metadata -> Bool Source #

Whether an item is a group index page (`index: true` in its front matter)

isSitemapExcluded :: Metadata -> Bool Source #

Whether an item is marked `sitemap: false`, and so left out of the sitemap

isTemplated :: Compiler Bool Source #

Whether the current item is marked `templated: true`, and so may use template syntax in its body

groupOf :: FilePath -> Identifier -> Metadata -> Maybe String Source #

The group an item belongs to: its `group:` front matter, or the folder it sits in under `writings/`

aliasesOf :: Metadata -> Either [String] [FilePath] Source #

Old paths an item should redirect from (`aliases: [old]`, or a single `aliases: old`)

Each must be an absolute path other than the home page.

parseAliasesYaml :: String -> Either [String] [FilePath] Source #

aliasesOf on YAML text (the same shape as front matter)

parsePost :: Metadata -> Either [String] Post Source #

Parses front matter, reporting every problem (not just the first)

parsePostYaml :: String -> Either [String] Post Source #

parsePost on YAML text (the same shape as front matter)

parseNavEntry :: Metadata -> Either [String] (Maybe NavEntry) Source #

The menu entry a page asks for, if it has a `nav:` label (it then also needs navOrder and path)

parseNavYaml :: String -> Either [String] (Maybe NavEntry) Source #

parseNavEntry on YAML text (the same shape as front matter)

showcaseKey :: Project -> (Int, Down Day) Source #

Sort key for the showcase: projects with a priority first (lowest number first), then the rest, newest start first

requirePost :: Compiler Post Source #

Parses the current item's front matter, failing the build with the problems found

requirePostOf :: Identifier -> Compiler Post Source #

Parses the front matter of any item, failing the build (naming it) with the problems found

requireLanguage :: Identifier -> Compiler Language Source #

The language of an item, failing the build if it's not a known one

requireNav :: Identifier -> Compiler (Maybe NavEntry) Source #

The menu entry of any page, failing the build (naming the page) if it's invalid

requireProject :: Item String -> Compiler Project Source #

Parses a project item (its body is the YAML), failing the build with the problems found

requireSocials :: Item String -> Compiler [Social] Source #

Parses the socials item (its body is the YAML list), failing the build with the problems found