最小的Hakyll网站

时间:2017-09-21 03:30:15

标签: haskell static-site hakyll

我知道有一个由

给出的示例网站
hakyll-init app

但是我希望减少更多的骨骼,只需要在根目录中显示1个降价页面,“localhost:8000/”和别名“localhost:8000/index.html。”

根据说明,我创建了这个:

.
├── app
│   ├── app.cabal
│   ├── _cache
│   │   └── d5c19886a1234f571c624d44ba520d2b
│   ├── css
│   │   └── default.css
│   ├── images
│   ├── index.markdown
│   ├── _site
│   │   ├── css
│   │   │   └── default.css
│   │   └── images
│   ├── site.hs
│   ├── stack.yaml
│   └── templates
│       └── default.html

我有以下内容:

site.hs

--------------------------------------------------------------------------------
{-# 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 "index.markdown" $ do
        route   $ "index" + setExtension "html"
        compile $ pandocCompiler
            >>= loadAndApplyTemplate "templates/default.html" defaultContext
            >>= relativizeUrls

    create "/" $ do
        route   $ "index" + setExtension "html"
        compile $ pandocCompiler
            >>= loadAndApplyTemplate "templates/default.html" defaultContext
            >>= relativizeUrls

--------------------------------------------------------------------------------
postCtx :: Context String
postCtx =
    dateField "date" "%B %e, %Y" `mappend`
    defaultContext

这似乎是编译:

app $ stack exec site watch
Listening on http://127.0.0.1:8000
Initialising...
  Creating store...
  Creating provider...
  Running rules...
Checking for out-of-date items
Compiling
Success

但是当我加载http://127.0.0.1:8000http://localhost:8000/index.html时,我看不到我的模板,我看到了:

File not found

如何修复site.hs最小的Hakyll(只有从markdown存根创建的index.html),如何更好地理解调试?例如,在这里,我希望在编译时看到某种“无法找到的东西”。我在哪里找那个?

0 个答案:

没有答案