Pages

Monday, 3 February 2025

Inkval - 基于 Pandoc 与 Bash 的静态网站生成器

 

项目地址:https://www.chunqiuyiyu.com/inkval/

示例博客:https://www.chunqiuyiyu.com/

为了摆脱 Hexo 所需 node_modules 中的一堆依赖,用 Shell Script 构建了这个项目。300 多行 10KB 左右的脚本满足了个人博客所需的所有特性:分页、RSS 、标签还有标签别名。生成网站的 Lighthouse 评分也没什么问题。

---------------------------------------------------------

Generating Static Sites with Pandoc and Bash

www.chunqiuyiyu.com/inkval/ 

Inkval GitHub code size in bytes

Features

  • Only based on Pandoc and GNU core utilities
  • Perfect score(100) on Google lighthouse
  • Easy to use and expand functions
  • Pagination support
  • Tag slug support
  • RSS support

For more information, visit website and docs.

Usage

curl -s https://raw.githubusercontent.com/chunqiuyiyu/inkval/main/inkval.sh | bash
# or
wget -qO - https://raw.githubusercontent.com/chunqiuyiyu/inkval/main/inkval.sh | bash

Tips

You should use last release Paondoc to avoid bugs and get better experiences.

(https://github.com/jgm/pandoc/releases/download/3.6.2/pandoc-3.6.2-windows-x86_64.zip 或安装版:https://github.com/jgm/pandoc/releases/download/3.6.2/pandoc-3.6.2-windows-x86_64.msi)

from https://github.com/chunqiuyiyu/inkval 

-----------------------------------------------------

我的补充说明:

登录linux vps.

首先安装 pandoc.

wget  https://github.com/jgm/pandoc/releases/download/3.6.2/pandoc-3.6.2-linux-amd64.tar.gz

tar xvf  pandoc-3.6.2-linux-amd64.tar.gz

 cd pandoc-3.6.2

root@racknerd-626f077:~/pandoc-3.6.2# ls
bin  share
root@racknerd-626f077:~/pandoc-3.6.2# cd bin
root@racknerd-626f077:~/pandoc-3.6.2/bin# ls
pandoc  pandoc-lua  pandoc-server

root@racknerd-626f077:~/pandoc-3.6.2/bin# echo 'export PATH=$PATH:/root/pandoc-3.6.2/bin' >> /etc/profile && source /etc/profile

root@racknerd-626f077:~/pandoc-3.6.2/bin# which pandoc
/root/pandoc-3.6.2/bin/pandoc
root@racknerd-626f077:~/pandoc-3.6.2/bin# cd ~

git clone  https://github.com/chunqiuyiyu/inkval 

cd inkval

 mv site/* ./

root@racknerd-626f077:~/inkval# ls
content  inkval.sh  LICENSE      README.md  site

layout     preview.gif  score.png
root@racknerd-626f077:~/inkval# chmod 755 inkval.sh

root@racknerd-626f077:~/inkval#  ./inkval.sh

root@racknerd-626f077:~/inkval# ls
content  inkval.sh  LICENSE      README.md  site
dist     layout     preview.gif  score.png
root@racknerd-626f077:~/inkval# cd dist

~/inkval/dist/里面有index.html,所以 ~/inkval/dist/就是静态网站的根目录。

不过 ~/inkval/dist/所展示的静态网站的效果很简陋。

root@racknerd-626f077:~/inkval/dist# cd ~

root@racknerd-626f077:~# git clone https://github.com/chunqiuyiyu/chunqiuyiyu.com

root@racknerd-626f077:~# cd chunqiuyiyu.com

root@racknerd-626f077:~/chunqiuyiyu.com# cp ~/inkval/inkval.sh ./

root@racknerd-626f077:~/chunqiuyiyu.com# ./inkval.sh (此即生成/更新静态网站的根目录的命令)

当前目录下,就会生成dist 目录。

~/chunqiuyiyu.com/dist/里面有index.html文件,说明

~/chunqiuyiyu.com/dist/就是静态网站的根目录,你可以绑定你的域名到该目录。(我是安装了nginx, 然后修改nginx的配置文件实现的。

 不过还需要修改配置文件https://github.com/chunqiuyiyu/chunqiuyiyu.com/blob/main/content/index.md,把第7行的 link的值改为http://urdomain.com ,然后cd到~/chunqiuyiyu.com/,然后运行./inkval.sh即可。

项目地址:

https://github.com/chunqiuyiyu/inkval 

配置文件在哪里 · Issue #6

chunqiuyiyu/chunqiuyiyu.com

演示网站:http://cqyyc.smt.biz.st/


 


 

 


 

 

 

 

 

 

 

No comments:

Post a Comment