pelican 如何添加404页面

pelican 已经挂在了github上面了但是如何挂上一个404 页面

Title: Not Found
Status: hidden
Save_as: 404.html

<script type="text/javascript" src="http://www.qq.com/404/search_children.js" charset="utf-8" homePageUrl="http://www.caimaoy.com" homePageName="Back to Home Page"></script>

源码里面要说的几点

  • 添加Status: hidden这个元信息
  • Save_as为404.html,这样的话就满足了github的要求
  • 挂上这一段js,出自我旁边的鹅厂这样的事业还是要支持一下的
  • 最后看一看:效果图

TODO

  • 当然也是因为我没有找到pelican直接挂原始页面的办法 ...
more ...

使用Pelican在Github上建立个人博客

相关连接

基础知识

配置文件

这个应该是说得比较多的一部分了,因为使用windows(我也不想用!!!)不得不改动一下配置文件
重点修改如下

Makefile

对于windows用户你可能要敢以下几件事

  1. 下载make.exe, 并且添加到环境变量中
  2. 修改Makefile文件关键是一些路径,具体忘记是哪些了,你可以去看这个blog的源代码对比一下

pelicanconfig.py

git: publish
    git push origin $(GITHUB_PAGES_BRANCH)
    ghp-import -b $(GITHUB_PAGES_BRANCH) $(OUTPUTDIR) -p

其中git的部分你懂就应该懂,说一下ghp-import
ghp-import 是用于分支发布的,也就是说你的源码是在一个分支,而生成的页面是在另外一个分支发布

ghp-import on Windows

Until ghp-import ...

more ...

关于我

一个在国人F3的打工仔

The Zen of Python, by Tim Peters

  • Beautiful is better than ugly.
  • Explicit is better than implicit.
  • Simple is better than complex.
  • Complex is better than complicated.
  • Flat is better than nested.
  • Sparse is better than dense.
  • Readability counts.
  • Special cases aren't special enough to break the rules ...
more ...