我看到 create 函数需要一个标识符列表。
ghci λ> :t create
create :: [Identifier] -> Rules () -> Rules ()
我应该使用哪个标识符列表来匹配站点的根目录?例如,我只想制作一个出现在“www.example.com”上的没有“/posts”或“/archives”或任何其他域部分的html页面。
我试过几个:
create "/" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "/*" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "." $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "./" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "/." $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create "" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
和
create Nothing $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
我收到如下错误:
site.hs:24:12: error:
• Couldn't match type ‘Identifier’ with ‘Char’
arising from the literal ‘""’
• In the first argument of ‘create’, namely ‘""’
In the expression: create ""
In a stmt of a 'do' block:
create ""
$ do { route idRoute;
compile
$ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls }
Failed, modules loaded: none.
Loaded GHCi configuration from /tmp/ghci29841/ghci-script
我不能说:i Identifier
或阅读文档或阅读源代码,这对我来说更清楚:
ghci λ> :i Identifier
data Identifier
= Hakyll.Core.Identifier.Identifier {identifierVersion :: Maybe
String,
Hakyll.Core.Identifier.identifierPath :: String}
-- Defined in ‘Hakyll.Core.Identifier’
instance Eq Identifier -- Defined in ‘Hakyll.Core.Identifier’
instance Ord Identifier -- Defined in ‘Hakyll.Core.Identifier’
instance Show Identifier -- Defined in ‘Hakyll.Core.Identifier’
我应该使用什么魔法咒语来创建将出现“/”的 html,我应该如何更好地调查它以使其不那么神秘?