我知道有一个示例网站
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
我有以下内容:
网站.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:8000
, or时http://localhost:8000/index.html
,我没有看到我的模板,我看到:
File not found
如何修复site.hs
最小的 Hakyll(仅从 Markdownindex.html
存根创建),如何更好地理解调试?例如,在这里我希望在编译时看到某种“找不到东西”。我去哪里找那个?