Add debug page
This commit is contained in:
parent
aabb0f890b
commit
841fdf1ac2
47
src/2022-03-27-debug.md
Normal file
47
src/2022-03-27-debug.md
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
title: "Debug page"
|
||||||
|
desc: "Testing out some stuff"
|
||||||
|
keywords: "nix, nixos, linux"
|
||||||
|
updated: "2022-03-27"
|
||||||
|
---
|
||||||
|
|
||||||
|
### Logo links:
|
||||||
|
|
||||||
|
This is a logo link in the middle of a text: [nani|h7x4/dotfiles]. Isnt' it kinda cool?
|
||||||
|
|
||||||
|
[nxo|environment.etc]
|
||||||
|
[nxp|niv]
|
||||||
|
[nani|h7x4/dotfiles]
|
||||||
|
[ga|gitea/tea]
|
||||||
|
[gl|gitlab-org/gitlab]
|
||||||
|
[rd|Company-wide email + 30,000 employees + auto-responders = ...](https://www.reddit.com/r/talesfromtechsupport/comments/420oan/companywide_email_30000_employees_autoresponders/)
|
||||||
|
[wiki|Computer Programming](https://en.wikipedia.org/wiki/Computer_programming)
|
||||||
|
[hg|>>=]
|
||||||
|
[hk|pcre-heavy]
|
||||||
|
[so|YouTube iframe embed - full screen](https://stackoverflow.com/questions/27723423/youtube-iframe-embed-full-screen)
|
||||||
|
[crt|clap]
|
||||||
|
[npm|unofficial-jisho-api]
|
||||||
|
[pub|unofficial_jisho_api]
|
||||||
|
[yt|dQw4w9WgXcQ]
|
||||||
|
|
||||||
|
[kan|漢](かん)[kan|字](じ)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
Here's some haskell code:
|
||||||
|
|
||||||
|
```haskell
|
||||||
|
titleRoute :: Metadata -> Maybe Routes
|
||||||
|
titleRoute metadata = constRoute <$> fileNameFromTitle metadata
|
||||||
|
where
|
||||||
|
slug :: String -> String
|
||||||
|
slug = T.unpack . (`T.append` ".html") . Slugger.toSlug . T.pack
|
||||||
|
|
||||||
|
ignore :: Eq a => a -> a -> Maybe a
|
||||||
|
ignore shouldBeIgnored value
|
||||||
|
| shouldBeIgnored == value = Nothing
|
||||||
|
| otherwise = Just value
|
||||||
|
|
||||||
|
fileNameFromTitle :: Metadata -> Maybe FilePath
|
||||||
|
fileNameFromTitle metadata = slug <$> (ignore "" =<< lookupString "title" metadata)
|
||||||
|
```
|
@ -103,6 +103,19 @@ main = hakyllWith config $ do
|
|||||||
>>= saveSnapshot "content"
|
>>= saveSnapshot "content"
|
||||||
>>= loadAndApplyTemplate "templates/default.html" ctx
|
>>= loadAndApplyTemplate "templates/default.html" ctx
|
||||||
|
|
||||||
|
match "*debug.md" $ do
|
||||||
|
let ctx = constField "type" "article" <> postCtx
|
||||||
|
|
||||||
|
route $ constRoute "debug.html"
|
||||||
|
|
||||||
|
compile $
|
||||||
|
getResourceBody
|
||||||
|
>>= replaceLogoLinks
|
||||||
|
>>= pandocRendererCustom
|
||||||
|
>>= loadAndApplyTemplate "templates/post.html" ctx
|
||||||
|
>>= saveSnapshot "content"
|
||||||
|
>>= loadAndApplyTemplate "templates/default.html" ctx
|
||||||
|
|
||||||
match "index.html" $ do
|
match "index.html" $ do
|
||||||
route idRoute
|
route idRoute
|
||||||
compile $ do
|
compile $ do
|
||||||
|
Loading…
Reference in New Issue
Block a user