站长网 教程 安装 Pelican 并创建仓库体现价值

安装 Pelican 并创建仓库体现价值

副标题#e# 首先,你必须在本地计算机上安装 Pelican 和ghp-import。使用 Python 软件包安装工具 pip(你有,对吧?),这非常容易: $ pip install pelican ghp-importMarkdown 然后,打开浏览器并在 GitHub 上为你新鲜出炉的博客创建一个新仓库,命名如下

副标题#e#

首先,你必须在本地计算机上安装 Pelican 和 ghp-import。使用 Python 软件包安装工具 pip(你有,对吧?),这非常容易:

$ pip install pelican ghp-importMarkdown

然后,打开浏览器并在 GitHub 上为你新鲜出炉的博客创建一个新仓库,命名如下(在此处以及整个教程中,用 GitHub 用户名替换 username):

https://GitHub.com/username/username.github.io

让它保持为空,稍后我们用引人注目的博客内容来填充它。

使用命令行(确保正确),将这个空 Git 仓库克隆到本地计算机:

$ gitclone<https://GitHub.com/username/username.github.io> blog

$ cd blog

奇怪的把戏…

在 GitHub 上发布 Web 内容有一个不太引入注意的技巧,对于托管在名为 username.github.io 的仓库的用户页面,其内容由 master 分支提供服务。

我强烈建议所有的 Pelican 配置文件和原始的 Markdown 文件都不要保留在 master 中,master 中只保留 Web 内容。因此,我将 Pelican 配置和原始内容保留在一个我喜欢称为 content 的单独分支中。(你可以随意创建一个分支,但以下内容沿用 content。)我喜欢这种结构,因为我可以放弃掉 master 中的所有文件,然后用 content 分支重新填充它。

$ git checkout -b content

Switched to a new branch 'content'

配置 Pelican

现在该进行内容配置了。Pelican 提供了一个很棒的初始化工具 pelican-quickstart,它会询问你有关博客的一系列问题。

$ pelican-quickstart

Welcome to pelican-quickstart v3.7.1.

 

Thisscript will help you create a newPelican-based website.

 

Please answer the following questions so thisscript can generate the files

needed by Pelican.

 

>Wheredo you want to create your new web site?[.]

>What will be the title of this web site?Super blog

>Who will be the author of this web site? username

>What will be the default language of this web site?[en]

>Do you want to specify a URL prefix? e.g., http://example.com (Y/n) n

>Do you want to enable article pagination?(Y/n)

>How many articles per page do you want?[10]

>Whatis your time zone?[Europe/Paris] US/Central

>Do you want to generate a Fabfile/Makefile to automate generation and publishing?(Y/n) y

>Do you want an auto-reload & simpleHTTP script to assist with theme and site development?(Y/n) y

>Do you want to upload your website using FTP?(y/N) n

>Do you want to upload your website using SSH?(y/N) n

>Do you want to upload your website usingDropbox?(y/N) n

#p#副标题#e#

>Do you want to upload your website using S3?(y/N) n

>Do you want to upload your website usingRackspaceCloudFiles?(y/N) n

>Do you want to upload your website usingGitHubPages?(y/N) y

>Isthis your personal page (username.github.io)?(y/N) y

Done.Yournew project is available at /Users/username/blog

你可以对每个问题都采用默认值,但除了以下这些问题:

网站标题,应该唯一且特殊

网站作者,可以是个人用户名或你的全名

时区,可能你不在巴黎

上传到 GitHub 页面,我们选择 y

回答完所有问题后,Pelican 会在当前目录中留下以下内容:

$ ls

Makefile content/ develop_server.sh*

fabfile.py output/ pelicanconf.py

本文来自网络,不代表站长网立场,转载请注明出处:https://www.tzzz.com.cn/html/video/2021/0601/8174.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部