Pages

Saturday, 26 October 2024

搭建基于rust的静态博客程序leven

 我的本地机器是windows.项目提供了windows上的可执行文件,就去下载之,懒得编译了。(windows上,我还没装过rust环境)

下载地址:

https://github.com/leven-the-blog/leven/releases/download/v0.6.0/leven-v0.6.0-i686-pc-windows-msvc.zip

下载后,解压。 我解压到了:

~/Downloads/Compressed/leven-v0.6.0-i686-pc-windows-msvc/。

在git-bash.exe程序窗口里,

cd ~/Downloads/Compressed/leven-v0.6.0-i686-pc-windows-msvc/

$ ls

leven.exe

$ ./leven.exe --help
leven 0.6.0
Ram Kaniyur <quadrupleslap@gmail.com>
Make your own blog!

USAGE:
    leven.exe <SUBCOMMAND>

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    build    Build the blog into static files
    new      Create a new blog
 $ ./leven.exe new leven-blog (此命令会在当前目录下,生成leven-blog目录)

$ cd leven-blog

$ ls
Leven.toml  content/   theme/

$ nano leven.toml  (把recents的值改为3)

$ cd theme/templates

$ ls

archive.html  index.html  post.html

(分别编辑这3个html文件,在第2行,写上:<meta charset="UTF-8">这样可以防止中文内容变成乱码

$ cd ~/Downloads/Compressed/leven-v0.6.0-i686-pc-windows-msvc/leven-blog

$ ../leven.exe build (此命令就是生成/更新静态网站的根目录的命令)

$ ls
Leven.toml  content/  out/  theme/ (生成了out目录)

$ cd out

$ ls
archive.html hello-stranger.html  assets/  index.html ( 说明out目录就是静态网站的根目录)

新建源贴:

 $ cd ../content

$ ls
'Hello, Stranger!.md'

$ nano  happy-festival.md

$ cat happy-festival.md

显示:

## 快乐的节日

此处写正文或html codes.

$ cd ..

$  ../leven.exe build

显示:

[INFO]  Build complete!

$ cd out

$ pwd

~/Downloads/Compressed/leven-v0.6.0-i686-pc-windows-msvc/leven-blog/out

访问app.netlify.com/drop,点击“browse to upload",

定位到静态网站的根目录:~/Downloads/Compressed/leven-v0.6.0-i686-pc-windows-msvc/leven-blog/out目录,上传根目录的内容即可。上传完成后,就会得到链接

https://zingy-puffpuff-7c2437.netlify.app/,这就是我托管在netlify.com空间上的静态博客网站的地址

https://zingy-puffpuff-7c2437.netlify.app/archive

此程序没有分页功能。

演示网站: https://zingy-puffpuff-7c2437.netlify.app/

项目地址:https://github.com/leven-the-blog/leven

https://github.com/leven-the-blog/leven/issues/29

https://github.com/leven-the-blog/leven/releases

 




 

 


 




 

 


 


No comments:

Post a Comment