安装配置hugo

13 篇文章 0 订阅

title: “安装配置hugo”
date: 2021-12-05T12:50:03+08:00
draft: true


初始配置

官网下载

https://github.com/gohugoio/hugo/releases

下载目录:

C:\Users\Administrator\go\src\HugoMyblog

安装配置

解压安装

查看版本

root@wangwei830:/opt/blog# ./hugo version
hugo v0.89.4-AB01BA6E linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio

创建myblog目录及配套文件:

root@wangwei830:/opt/blog# hugo new site myblog
Congratulations! Your new Hugo site is created in /opt/blog/myblog.

Just a few more steps and you're ready to go:

1. Download a theme into the same-named folder.
   Choose a theme from https://themes.gohugo.io/ or
   create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
   with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".

Visit https://gohugo.io/ for quickstart guide and full documentation.

调整目录:

把解压的出来的命令文件剪切到myblog目录下

下载模板:

root@wangwei830:/opt/blog# 

cd /opt/blog/myblog/themes
git clone https://themes.gohugo.io/themes/hugo-theme-learn/

本地启动服务:

root@wangwei830:/opt/blog/myblog# hugo server -t hugo-theme-learn --buildDrafts
Start building sites … 
hugo v0.89.4-AB01BA6E linux/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio

                   | EN  

-------------------+-----
  Pages            |  7  
  Paginator pages  |  0  
  Non-page files   |  0  
  Static files     | 75  
  Processed images |  0  
  Aliases          |  0  
  Sitemaps         |  1  
  Cleaned          |  0  

Built in 55 ms
Watching for changes in /opt/blog/myblog/{archetypes,content,data,layouts,static,themes}
Watching for config changes in /opt/blog/myblog/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop


新建一篇文章

C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog> .\hugo.exe new post/安装配置hugo.md

然后写入文章内容

站点托管

创建仓库与用户同名

 简易的命令行入门教程:

Git 全局设置:

git config --global user.name "汪伟"
git config --global user.email "wangwei198484@163.com"

创建 git 仓库:

mkdir wangwei830
cd wangwei830
git init
touch README.md
git add README.md
git commit -m "first commit"
git remote add origin https://gitee.com/wangwei830/wangwei830.git
git push -u origin master

已有仓库?

cd existing_git_repo
git remote add origin https://gitee.com/wangwei830/wangwei830.git
git push -u origin master


绑定地址

绑定地址后会生成一个pbulic文件夹

PS C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog> .\hugo.exe --theme=hugo-theme-learn --baseUrl="https://wangwei830.github.io/" --buildDrafts
Start building sites …
hugo v0.89.4-AB01BA6E windows/amd64 BuildDate=2021-11-17T08:24:09Z VendorInfo=gohugoio
.File.UniqueID on zero object. Wrap it in if or with: {{ with .File }}{{ .UniqueID }}{{ end }}

                   | EN

-------------------+-----
  Pages            | 10
  Paginator pages  |  0
  Non-page files   |  0
  Static files     | 75
  Processed images |  0
  Aliases          |  0
  Sitemaps         |  1
  Cleaned          |  0

Total in 543 ms
PS C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog>

推送public目录内容

cd public 

git init

git add .

git commit -m "20211205"

git remote add origin https://gitee.com/wangwei830/wangwei830.git
git push -u origin master

仓库开启Pages服务

需要身份证

访问博客

wangwei830.git.io

使用

更新文章内容

cd C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog

.\hugo.exe --theme=hugo-theme-learn --baseUrl="https://wangwei830.github.io/" --buildDrafts

发表新文章

cd C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog

.\hugo.exe new post/安装配置hugo.md

.\hugo.exe --theme=hugo-theme-learn --baseUrl="https://wangwei830.github.io/" --buildDrafts

跟换新模板

cd C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog\themes

git clone https://themes.gohugo.io/themes/hugo-book/
git clone https://github.com/alexandrevicenzi/soho

新模板启动本地blog服务

cd C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog

.\hugo.exe server -t soho --buildDrafts

目录设计

cd C:\Users\Administrator\go\src\HugoMyblog\hugo_0.89.4_Windows-64bit\myblog
# 操作系统
.\hugo.exe new Linux/init.md
.\hugo.exe new Aix/init.md
.\hugo.exe new HPUX/init.md
.\hugo.exe new Windows/init.md
# 数据库
.\hugo.exe new Mysql/init.md
.\hugo.exe new Postgres/init.md
.\hugo.exe new Oracle/init.md
.\hugo.exe new Tidb/init.md
.\hugo.exe new DB2/init.md
.\hugo.exe new Informix/init.md
# 开发
.\hugo.exe new Python/init.md
.\hugo.exe new Golang/init.md
.\hugo.exe new Csharp/init.md
.\hugo.exe new Shell/init.md
# 未分类
.\hugo.exe new Other/init.md
#主页
.\hugo.exe new _index.md

.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md

.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md
.\hugo.exe new Linux//init.md


安装Python的步骤如下: 1. 下载Python的安装包并双击打开。 2. 在安装向导中选择安装选项,最好勾选上"Add Python 3.10 to PATH",这样可以将Python添加到系统的环境变量中,方便在命令提示符中直接使用Python命令。 3. 根据安装向导的提示,选择安装目录。安装目录是Python的安装路径,记下这个路径,后面可能会用到。完成安装后,可以在安装目录中找到Python的可执行文件和库文件。 4. 安装完成后,可以通过在命令提示符中输入"python"来检查Python是否成功安装。如果返回的结果显示找不到Python,说明Python的环境变量没有配置成功。此时,需要手动配置环境变量。 配置Python的环境变量的步骤如下: 1. 打开控制面板,并进入"系统和安全"->"系统"->"高级系统设置"。 2. 在弹出的窗口中,点击"环境变量"按钮。 3. 在"系统变量"列表中,找到名为"Path"的变量,并点击"编辑"按钮。 4. 在弹出的窗口中,点击"新建"按钮,然后将Python的安装目录路径粘贴到输入框中。可以有多个路径,每个路径之间用分号分隔。一般来说,需要添加Python的根目录和Scripts目录。 5. 点击"确定"按钮保存配置,并关闭所有窗口。 完成以上步骤后,Python的安装配置就完成了。现在可以在命令提示符中直接使用Python命令了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [Python环境的安装配置](https://blog.csdn.net/m0_60494863/article/details/127825223)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [Python安装与环境配置,超详细保姆级教程,学不会退出IT圈](https://blog.csdn.net/hugo233/article/details/128496807)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值