diff options
author | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2019-12-29 00:10:26 +0100 |
---|---|---|
committer | Paweł Dybiec <pawel.to.malpa@gmail.com> | 2019-12-29 00:10:26 +0100 |
commit | 9fdd10accfc7bd7d8f7f88cfb383100ee8cb83ee (patch) | |
tree | ea06f74795b221ae8412dc47115687b200fc3904 | |
parent | Initial commit (diff) |
Template
-rw-r--r-- | about.md | 17 | ||||
-rw-r--r-- | contact.md | 6 | ||||
-rw-r--r-- | css/default.css | 104 | ||||
-rw-r--r-- | images/haskell-logo.png | bin | 0 -> 5674 bytes | |||
-rw-r--r-- | index.html | 16 | ||||
-rw-r--r-- | pdybiec.cabal | 11 | ||||
-rw-r--r-- | site.hs | 67 | ||||
-rw-r--r-- | stack.yaml | 77 | ||||
-rw-r--r-- | stack.yaml.lock | 19 | ||||
-rw-r--r-- | templates/archive.html | 2 | ||||
-rw-r--r-- | templates/default.html | 33 | ||||
-rw-r--r-- | templates/post-list.html | 7 | ||||
-rw-r--r-- | templates/post.html | 11 |
13 files changed, 370 insertions, 0 deletions
diff --git a/about.md b/about.md new file mode 100644 index 0000000..99af9e2 --- /dev/null +++ b/about.md @@ -0,0 +1,17 @@ +--- +title: About +--- +Nullam imperdiet sodales orci vitae molestie. Nunc quam orci, pharetra a +rhoncus vitae, eleifend id felis. Suspendisse potenti. Etiam vitae urna orci. +Quisque pellentesque dignissim felis, egestas tempus urna luctus vitae. In hac +habitasse platea dictumst. Morbi fringilla mattis odio, et mattis tellus +accumsan vitae. + +1. Amamus Unicode 碁 +2. Interdum nex magna. + +Vivamus eget mauris sit amet nulla laoreet lobortis. Nulla in diam elementum +risus convallis commodo. Cras vehicula varius dui vitae facilisis. Proin +elementum libero eget leo aliquet quis euismod orci vestibulum. Duis rhoncus +lorem consequat tellus vestibulum aliquam. Quisque orci orci, malesuada porta +blandit et, interdum nec magna. diff --git a/contact.md b/contact.md new file mode 100644 index 0000000..78e8698 --- /dev/null +++ b/contact.md @@ -0,0 +1,6 @@ +--- +title: Contact +--- + +I live in a small hut in the mountains of Kumano Kodō on Kii Hantō and would not +like to be contacted. diff --git a/css/default.css b/css/default.css new file mode 100644 index 0000000..d61b8af --- /dev/null +++ b/css/default.css @@ -0,0 +1,104 @@ + +html { + /* to allow the #footer to be properly positioned + at the bottom, even when #content is longer than + the viewport high */ + min-height: 100%; + position: relative; +} + +body { + color: black; + font-size: 16px; + margin: 0px; +} + +header { + margin-bottom: 0px; + padding: 50px; + background: linear-gradient(to right,#19111f 0%,#2c1e37 100%); +} + +div.logo a { + color: #FFFFFF; + float: left; + font-family: sans-serif; + font-size: 28px; + font-weight: bold; + text-decoration: none; +} + +header nav { + text-align: right; +} + +header nav a { + color: #d1cddc!important; + font-family: sans-serif; + font-size: 14px; + font-weight: bold; + margin-left: 12px; + text-decoration: none; + text-transform: uppercase; +} + +header nav a:hover{ + color: #FFFFFF; +} + +main { + margin-left: 50px; + margin-right: 50px; + margin-bottom: 5.5rem; /* footer-height + 1.5rem */ +} + +main h1{ + color: #6e618d; + font-size: 25px; + font-family: sans-serif; +} + +main h2{ + color: #6e618d; + font-size: 20px; + font-family: sans-serif; +} + +main, /* this line for archives page */ +main p{ + color: #333333; + font-family: sans-serif; + font-size: 15px; +} + +main a{ + color: #428bca; + text-decoration: none; +} + +footer { + color: #999999; + font-size: 12px; + text-align: center; + height: 4em; + background-color: #323232; + position: absolute; + bottom: 0; + width: 100%; + overflow: hidden; + padding-top: 1em; + font-family: sans-serif; +} + +footer a { + color: #ffffff; + font-weight: bold; + text-decoration: none; +} + +section.header { + color: #555; + font-size: 14px; + font-style: italic; +} + diff --git a/images/haskell-logo.png b/images/haskell-logo.png new file mode 100644 index 0000000..97c0937 --- /dev/null +++ b/images/haskell-logo.png Binary files differdiff --git a/index.html b/index.html new file mode 100644 index 0000000..6dd191d --- /dev/null +++ b/index.html @@ -0,0 +1,16 @@ +--- +title: Home +--- + +<h2>Welcome</h2> + +<img src="/images/haskell-logo.png" style="float: right; margin: 10px;" /> + +<p>Welcome to my blog!</p> + +<p>I've reproduced a list of recent posts here for your reading pleasure:</p> + +<h2>Posts</h2> +$partial("templates/post-list.html")$ + +<p>…or you can find more in the <a href="/archive.html">archives</a>.</p> diff --git a/pdybiec.cabal b/pdybiec.cabal new file mode 100644 index 0000000..4b154dc --- /dev/null +++ b/pdybiec.cabal @@ -0,0 +1,11 @@ +name: pdybiec +version: 0.1.0.0 +build-type: Simple +cabal-version: >= 1.10 + +executable site + main-is: site.hs + build-depends: base == 4.* + , hakyll == 4.13.* + ghc-options: -threaded + default-language: Haskell2010 diff --git a/site.hs b/site.hs new file mode 100644 index 0000000..210245c --- /dev/null +++ b/site.hs @@ -0,0 +1,67 @@ +-------------------------------------------------------------------------------- +{-# LANGUAGE OverloadedStrings #-} +import Data.Monoid (mappend) +import Hakyll + + +-------------------------------------------------------------------------------- +main :: IO () +main = hakyll $ do + match "images/*" $ do + route idRoute + compile copyFileCompiler + + match "css/*" $ do + route idRoute + compile compressCssCompiler + + match (fromList ["about.md", "contact.md"]) $ do + route $ setExtension "html" + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/default.html" defaultContext + >>= relativizeUrls + + match "posts/*" $ do + route $ setExtension "html" + compile $ pandocCompiler + >>= loadAndApplyTemplate "templates/post.html" postCtx + >>= loadAndApplyTemplate "templates/default.html" postCtx + >>= relativizeUrls + + create ["archive.html"] $ do + route idRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let archiveCtx = + listField "posts" postCtx (return posts) `mappend` + constField "title" "Archives" `mappend` + defaultContext + + makeItem "" + >>= loadAndApplyTemplate "templates/archive.html" archiveCtx + >>= loadAndApplyTemplate "templates/default.html" archiveCtx + >>= relativizeUrls + + + match "index.html" $ do + route idRoute + compile $ do + posts <- recentFirst =<< loadAll "posts/*" + let indexCtx = + listField "posts" postCtx (return posts) `mappend` + constField "title" "Home" `mappend` + defaultContext + + getResourceBody + >>= applyAsTemplate indexCtx + >>= loadAndApplyTemplate "templates/default.html" indexCtx + >>= relativizeUrls + + match "templates/*" $ compile templateBodyCompiler + + +-------------------------------------------------------------------------------- +postCtx :: Context String +postCtx = + dateField "date" "%B %e, %Y" `mappend` + defaultContext diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..5cd82c4 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,77 @@ +# This file was automatically generated by 'stack init' +# +# Some commonly used options have been documented as comments in this file. +# For advanced use and comprehensive documentation of the format, please see: +# https://docs.haskellstack.org/en/stable/yaml_configuration/ + +# A warning or info to be displayed to the user on config load. +user-message: | + Warning (added by new or init): Some packages were found to be incompatible with the resolver and have been left commented out in the packages section. + You can omit this message by removing it from stack.yaml + +# Resolver to choose a 'specific' stackage snapshot or a compiler version. +# A snapshot resolver dictates the compiler version and the set of packages +# to be used for project dependencies. For example: +# +# resolver: lts-3.5 +# resolver: nightly-2015-09-21 +# resolver: ghc-7.10.2 +# +# The location of a snapshot can be provided as a file or url. Stack assumes +# a snapshot provided as a file might change, whereas a url resource does not. +# +# resolver: ./custom-snapshot.yaml +# resolver: https://example.com/snapshots/2018-01-01.yaml +resolver: lts-14.14 + +# User packages to be built. +# Various formats can be used as shown in the example below. +# +# packages: +# - some-directory +# - https://example.com/foo/bar/baz-0.0.2.tar.gz +# subdirs: +# - auto-update +# - wai +packages: +- . +# The following packages have been ignored due to incompatibility with the +# resolver compiler, dependency conflicts with other packages +# or unsatisfied dependencies. +#- . + +# Dependency packages to be pulled from upstream that are not in the resolver. +# These entries can reference officially published versions as well as +# forks / in-progress versions pinned to a git hash. For example: +# +# extra-deps: +# - acme-missiles-0.3 +# - git: https://github.com/commercialhaskell/stack.git +# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a +# +extra-deps: +- hakyll-4.13.0.1 + +# Override default flag values for local packages and extra-deps +# flags: {} + +# Extra package databases containing global packages +# extra-package-dbs: [] + +# Control whether we use the GHC we find on the path +# system-ghc: true +# +# Require a specific version of stack, using version ranges +# require-stack-version: -any # Default +# require-stack-version: ">=2.1" +# +# Override the architecture used by stack, especially useful on Windows +# arch: i386 +# arch: x86_64 +# +# Extra directories used by stack for building +# extra-include-dirs: [/path/to/dir] +# extra-lib-dirs: [/path/to/dir] +# +# Allow a newer minor version of GHC than the snapshot specifies +# compiler-check: newer-minor diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..20757a4 --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,19 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + hackage: hakyll-4.13.0.1@sha256:0f27d74feaedc96648ec5377ecec2b35dd677516c9667d179462a350f2075628,8817 + pantry-tree: + size: 7841 + sha256: 4a4409d287ee3daabb0141e3ebd3d2e88ead7382ba5cc582733907b4a938c4a8 + original: + hackage: hakyll-4.13.0.1 +snapshots: +- completed: + size: 525663 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/14.yaml + sha256: 6edc48df46eb8bf7b861e98dd30d021a92c2e1820c9bb6528aac5d997b0e14ef + original: lts-14.14 diff --git a/templates/archive.html b/templates/archive.html new file mode 100644 index 0000000..b43eeb2 --- /dev/null +++ b/templates/archive.html @@ -0,0 +1,2 @@ +Here you can find all my previous posts: +$partial("templates/post-list.html")$ diff --git a/templates/default.html b/templates/default.html new file mode 100644 index 0000000..e91badc --- /dev/null +++ b/templates/default.html @@ -0,0 +1,33 @@ +<!doctype html> +<html lang="en"> + <head> + <meta charset="utf-8"> + <meta http-equiv="x-ua-compatible" content="ie=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <title>My Hakyll Blog - $title$</title> + <link rel="stylesheet" href="/css/default.css" /> + </head> + <body> + <header> + <div class="logo"> + <a href="/">My Hakyll Blog</a> + </div> + <nav> + <a href="/">Home</a> + <a href="/about.html">About</a> + <a href="/contact.html">Contact</a> + <a href="/archive.html">Archive</a> + </nav> + </header> + + <main role="main"> + <h1>$title$</h1> + $body$ + </main> + + <footer> + Site proudly generated by + <a href="http://jaspervdj.be/hakyll">Hakyll</a> + </footer> + </body> +</html> diff --git a/templates/post-list.html b/templates/post-list.html new file mode 100644 index 0000000..71cf1b9 --- /dev/null +++ b/templates/post-list.html @@ -0,0 +1,7 @@ +<ul> + $for(posts)$ + <li> + <a href="$url$">$title$</a> - $date$ + </li> + $endfor$ +</ul> diff --git a/templates/post.html b/templates/post.html new file mode 100644 index 0000000..732149b --- /dev/null +++ b/templates/post.html @@ -0,0 +1,11 @@ +<article> + <section class="header"> + Posted on $date$ + $if(author)$ + by $author$ + $endif$ + </section> + <section> + $body$ + </section> +</article> |