pelican学习笔记之GITHUB建站(一)

pelican学习笔记(一)

2018/01/24

搜集教程

学习过程中参考了以下资料,感谢各位博主的辛苦奉献
1. 使用github搭建网站
2. 一步步在GitHub上创建博客主页
3. Github Help
4. pelican 的官方页
5. pelican 中文版,资料太古老,只做参考,不要实操
6. Pelican+Github博客搭建详细教程

静态网站生成器 static site generator

github 官方教程给出的是 jekyll,国内搜建站教程也是满眼的 jekll. jekll 是 ruby 写的。搭建本地环境还需要搭建完整的 ruby。这个东西一点都不熟悉,插件下载还要找代理,所有操作都要按照网上的教程按部就班,跟瞎子摸象一样。

github 是能够使用其他静态生成器的,比如 pelican 。由 python 编写,用户基数也很大,拥有丰富的插件和主题。

pelican 的功能

  • 支持 reStructuredText、Markdown、AsciiDoc 编写格式
  • 完全静态输出任何地方都很容易承载
  • 可以通过 Jinja templates 自定义 Themes
  • 多语言发布
  • 支持 Atom/Rss feeds
  • 代码语法高亮
  • 支持从 WordPress、Dotclear 、Rss feeds 等服务中导入信息
  • 模块化插件系统强大

建站 step by step

先根据xxx搭建python环境
vscode+pipenv

Create a project

新建一个文件夹,

mkdir -p ~/projects/yoursite
cd ~/projects/yoursite

环境安装和初始化

2018/01/25

pipenv install pelican markdown

运行初始化pipenv run pelican-quickstart,它会问些关于站点的基本问题。

Welcome to pelican-quickstart v3.7.1.
This script will help you create a new Pelican-based website.
Please answer the following questions so this script can generate the files
needed by Pelican.
> Where do you want to create your new web site? [.]
> What will be the title of this web site?
> Who will be the author of this web site?
> What will be the default language of this web site?
> Do you want to specify a URL prefix? e.g., http://example.com (Y/n)
> Do you want to enable article pagination? (Y/n)
and balabalabala……

创建第一篇文章

在创建文章之前,Pelican是不能运行的。在yoursite/content/目录下添加第一篇markdown。

Title: 我的第一篇文章
Date: 2018-01-25 11:37
Category: 日记

胡乱写点什么试试

生成页面

pipenv run pelican content

Title等信息一定要在第一行开始,不然会提示找不到。

预览

打开一个新的 terminal ,切换目录到output,然后开启 Pelican 的服务器:

cd /x..xx/yoursite/output
pipenv run python -m pelican.server

浏览http://localhost:8000/页面预览以下。

更新pelican

pipenv install --upgrade pelican

pelican站点目录组成

yourproject/
├── content
│   └── (pages)
├── output
├── develop_server.sh
├── fabfile.py
├── Makefile
├── pelicanconf.py       # Main settings file
└── publishconf.py       # Settings to use when ready to publish
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值