根据本指南,我试图让TravisCI自动部署我的Hakyll静态站点.
这是我的回购设置的方式.我有我的源代码分支,其中包含我的hakyll和markdown文件.它将html构建到_site
目录中,该目录设置为子模块,链接到我的master
分支.
我没有问题地构建网站,然后cd
进入_site目录.但是,当我尝试git add ./*
新生成的HTML文件时,我收到以下错误:
fatal: Pathspec './about.html' is in submodule '_site'
Run Code Online (Sandbox Code Playgroud)
当我尝试时git add --all
,我收到此错误:
git: pathspec.c:317: prefix_pathspec: Assertion `item->nowildcard_len <= item->len && item->prefix <= item->len' failed.
/home/travis/build.sh: line 245: 1566 Aborted git add --all
Run Code Online (Sandbox Code Playgroud)
造成这种情况的原因是什么,我该如何避免这种情况?
您可以在此处查看存储库.
我正在尝试做类似本教程中描述的内容,即向我的Hakyll博客添加标签,但不是为每个标签生成一个页面,只需要一个页面列出所有标签及其帖子.所以给定一个Post1
标记Tag1
,Post2
标记Tag1, Tag2
和Post3
标记Tag2
,我tags.html
会看起来像这样:
Tag1:
- Post1
- Post2
Tag2:
- Post2
- Post3
Run Code Online (Sandbox Code Playgroud)
但我是哈斯克尔的初学者,我并不完全理解哈基尔的所有monadic环境.这是我到目前为止所拥有的:
create ["tags.html"] $ do
route idRoute
tags <- buildTags "posts/*" (fromCapture "tags.html")
compile $
makeItem ""
>>= applyTemplate tagListTemplate defaultContext
>>= applyTemplate defaultTemplate defaultContext
>>= relativizeUrls
>>= cleanIndexUrls
Run Code Online (Sandbox Code Playgroud)
问题是,Tags
在我的博客中,我真的不知道是什么.我似乎无法将它们打印出来进行调试.(我尝试添加print tags
,但它不起作用.)所以我很难想到如何继续这个.
任何帮助深表感谢.
更新:我仍然没有更接近解决这个问题.这是我现在正在尝试的内容:
create ["tags.html"] $ do
route idRoute
tags <- buildTags "posts/*" (fromCapture "tags.html#")
let …
Run Code Online (Sandbox Code Playgroud) 我为自己维护了一个学术网站,它复制了我在我的简历中提供的大量材料.为了避免必须维护相同信息的多个文件,并保持同步,我主要使用tex和bib文件,并在乳胶中生成我的cv并使用htlatex作为网站.
作为一个改善我的Haskell知识的项目,我一直在考虑用一个基于haskell的静态站点生成器生成我的网站.我很容易找到几个hakyll网站,但只有几个,并且我不清楚hakyll设计解决的问题是什么问题没有被yst处理.我有兴趣了解人们所看到的每个人的比较优势和劣势,如果有任何特殊原因我可能想要从一个或另一个开始给出我目前的.tex和.bib文件基础.
我正在尝试用hakyll
in markdown
via写一篇文章pandoc
。
我成功地添加了一些图片、表格和代码块markdown
。但是,我想将我的图片和一些文字段落居中。
是否有可能中心的文字和配图pandoc
和markdown
标记语言?
我希望修改以下代码,以便不是生成网站上最新三个帖子的链接,而是完全重现帖子的正文,就像在传统博客中一样.我在理解下面发生的事情时遇到了一些困难,以及必要的改变是什么.
match "index.html" $ do
route idRoute
compile $ do
let indexCtx = field "posts" $ \_ ->
postList $ fmap (take 3) . recentFirst
getResourceBody
>>= applyAsTemplate indexCtx
>>= loadAndApplyTemplate "templates/default.html" postCtx
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud) ghc --make site.hs
Run Code Online (Sandbox Code Playgroud)
不过,我instlled GHC与堆栈,所以我可以不再运行ghc
,而是stack ghc
$ stack ghc --make site.hs
Invalid option `--make'
Run Code Online (Sandbox Code Playgroud)
我该怎么编译我的site.hs
?
我看到create函数带有一个Identifier列表.
ghci ?> :t create
create :: [Identifier] -> Rules () -> Rules ()
Run Code Online (Sandbox Code Playgroud)
我应该使用什么标识符列表来匹配站点的根目录?例如,我只想制作一个单独的html页面,该页面出现在"www.example.com"上,没有"/ posts"或"/ archives"或任何其他域名部分.
我试过几个:
create "/" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
和
create "/*" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
和
create "." $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
和
create "./" $ do
route idRoute
compile $ pandocCompiler
>>= loadAndApplyTemplate "templates/default.html" defaultContext
>>= …
Run Code Online (Sandbox Code Playgroud) 这样可行:
create ["archive.html"] $ do
route idRoute
compile $ do
posts <- (myRecentFirst gitTimes) =<< loadAll "posts/**"
let archiveCtx =
listField "posts" (postCtx allTags allCategories gitTimes) (return posts) `mappend`
constField "title" "Archives" `mappend`
(postCtx allTags allCategories gitTimes)
makeItem ""
>>= loadAndApplyTemplate "templates/archive.html" archiveCtx
>>= loadAndApplyTemplate "templates/default.html" archiveCtx
>>= relativizeUrls
Run Code Online (Sandbox Code Playgroud)
在archive.html中创建最近的帖子列表; 这是沼泽标准,它来自我认为的其中一个教程.除了postsCtx,这有点复杂,但在这里不应该相关.
但是,我想在正常帖子的侧边栏中列出一些最近的帖子.问题在于最近的帖子最终取决于他们自己.我试着从自己生成的列表中排除帖子本身,但我找不到一个好的地方去做.这是我到目前为止所得到的:
match "posts/**" $ do
route $ (gsubRoute "posts/" (const "")) `composeRoutes` setExtension "html"
compile $ do
recents <- (myRecentFirst gitTimes) =<< loadAll "posts/**"
let postsContext = postCtx allTags …
Run Code Online (Sandbox Code Playgroud) 我使用Hakyll生成一些文档,我注意到它有一种奇怪的方式来关闭它生成的代码中的HTML标记.
有一个页面,他们说你必须像他们一样生成标记,否则你的页面布局会在某些条件下被破坏,但我现在找不到它.
我创建了一个小测试页面(下面的代码),它有一个带有"普通"HTML标记的红色图层,以及一个带有类似于hakyll生成的标记的黄色图层.
我看不出两个div之间的Firefox有什么不同.
任何人都可以解释他们说的是真的吗?
<html>
<body>
<!-- NORMAL STYLE -->
<div style="background: red">
<p>Make available the code from the library you added to your application. Again, the way to do this varies between languages (from adding import statements in python to adding a jar to the classpath for java)</p>
<p>Create an instance of the client and, in your code, make calls to it through this instance's methods.</p>
</div>
<!-- HAKYLL STYLE -->
<div style="background: yellow"
><p
>Make available the …
Run Code Online (Sandbox Code Playgroud) 我想使用Hakyll框架实现多种语言的静态HTML网站.我没有提出更好的解决方案,而不仅仅是在website.com
路线下放置默认语言和路线上的任何其他自定义语言website.com/en
.因为我使用的是静态HTML并且有多种语言,所以我应该为每个页面提供多个版本about.html
.这些页面是自动生成的,所以这不是问题.但目前我跳过这些页面有问题......
我有这样的链接website.com/index.html
:
<a href=about.html>
Run Code Online (Sandbox Code Playgroud)
当我打开此链接时,website.com/en
我想跳转website.com/en/about.html
而不是website.com/about.html
.但在现实中,我从跳跃website.com/en
到website.com/about.html
.如果我改为从website.com/en/index.html
我跳到website.com/en/about.html
我想要的地方.所以我对两种可能的解决方案之一感兴趣:
website.com/en
我想被重定向到website.com/en/index.html
.我能看到的内容index.html
从website.com/en
,但不知何故,我不能妄下相对链接:(href=about.html
为更聪明的东西,所以我可以自动folder/about.html
从任何文件夹.任何帮助赞赏!