首页 > 其他分享 >Hugo+manpassant搭建博客

Hugo+manpassant搭建博客

时间:2022-10-03 14:02:46浏览次数:75  
标签:manpassant github Hugo boot 博客 chnq org hugo 搭建

前言

搭建步骤

  • 以管理员的身份打开cmd
  • Hugo+manpassant搭建博客_spring

# choco 包管理器
powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"

# 设置环境变量
SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin

# 安装hugo
choco install hugo -confirm

# 验证是否安装成功
hugo version

# 例如我们在D盘打开cmd,使用hugo创建一个文件夹hugo作为本地博客目录
hugo new site hugo

# gitbash进入到本地博客文件夹根目录,将hugo主题克隆到themes文件夹
cd <YOUR Bolg Root Dir>
git clone https://github.com/flysnow-org/maupassant-hugo themes/maupassant
# 克隆后,themes目录中就有了一个主题,复制config.toml到博客根目录

# cmd进入本地博客根目录,启动本地服务,浏览器访问http://localhost:1313/
hugo server

Hugo+manpassant搭建博客_git_02

  • 新建一篇文章
hugo new post/filename.md   # D:\hugo\content\post目录下会生成一篇文章

# 新生成的文章中开头有一个属性,需改为false,否则本地启动服务后不会显示;或者使用hugo server -D启动
draft: true # 表示文章是否草稿,草稿内容不会被发布

# 以后每次生成文章,可使用如下方式配置属性

---
title: "Hugo+manpassant搭建博客"
author: "作者" # 文章作者
description : "描述信息" # 文章描述信息
date: 2021-12-04T10:57:09+08:00
lastmod: 2021-12-05 # 文章修改日期
draft: false
tags: # 标签
- Hugo
- Markdown
categories: # 分类
- 博客搭建
keywords: # 关键字
- Hugo
next: /chnq/github-pages-blog # 下一篇博客地址
prev: /chnq/automated-deployments # 上一篇博客地址
---
  • hugo配置文件
# 在本地将文章编译,部署到github后,通过baseURL跳转
baseURL = "https://chnq.github.io"
languageCode = "zh-CN"
title = "chnq"
theme = "maupassant"
# 页面文章数
paginate = 10
# 摘要字数
summaryLength = 70
[author]
name = "chnq"
## 友情链接
[[params.links]]
title = "c03的博客"
name = "c03的博客"
## 侧边栏广告
[[params.ads]]
title = "【2019双12】ALL IN CLoud 低至1折"
url = "https://www.aliyun.com/minisite/goods?userCode=jdg9oj97&share_source=copy_link"
img = "https://img.alicdn.com/tfs/TB1_rYHo7P2gK0jSZPxXXacQpXa-690-388.jpg"
## 开启版权声明,协议名字和链接都可以换
[params.cc]
name = "知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议"
link = "https://creativecommons.org/licenses/by-nc-nd/4.0/"
## 配置网站菜单
[menu]
[[menu.main]]
identifier = "tags"
name = "标签"
url = "/tags/"
weight = 2
[[menu.main]]
identifier = "categories"
name = "分类"
url = "/categories/"
weight = 3
[[menu.main]]
identifier = "archives"
name = "归档"
url = "/archives/"
weight = 4
  • 自定义菜单
# 在config.toml中配置子菜单,但点击时会报错:404 page not found
# 这是我们需要在D:\hugo\content路径下新建[tags、categories、archives]这三个文件夹,在文件夹中分别新建index.md
# 在index.html中分别编写如下

---
title: "标签"
description: "标签页面"
type: "tags"
---

---
title: "分类"
description: "分类页面"
type: "categories"
---

---
title: "归档"
description: "归档页面"
type: "archives"
---
  • 站内搜索
# 参考以上案例,在D:\hugo\content路径下新建search文件夹,并新建index.md,编写如下内容

---
title: "搜索"
description: "搜索页面"
type: "search"
---

部署

  • 在github新建一个仓库,格式为​​账户名.github.io​
# 进入本地博客文件夹根目录,编译文章
hugo

# 进入public目录,初始化仓库
git init

# 初始化本地仓库后时master分支,需切换为与github上相同的main分支
git branch -M main

# 将所有内容添加到git
git add .

# 暂存文件时,报错:warning: LF will be replaced by CRLF in **
git config core.autocrlf false

# 提交到git本地
git commit -m "博客初始化"

# 关联到远程git
git remote add origin [email protected]:chnq/chnq.github.io.git

# 推送到远程git
git push -u origin master
  • 访问​​https://chnq.github.io​

编写文章

  • 插入图片
# 在D:\hugo\static路径下新建一个文件夹images,将图片放到该路径下
# 在文章中插入图片,启动服务后本地可查看;编译后远程也可查看
![](/images/test_images.jpg)
  • ​以下为测试代码块​
  • 代码块1

点击查看详情

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
  • 代码块2
server:
port: 8080

spring:
application:
name: mybatisdemo
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.0.102:3306/mybatisdemo?characterEncoding=utf-8&serverTimezone=UTC
username: root
password: 123456
mvc:
view:
suffix: ".html"

mybatis:
configuration:
map-underscore-to-camel-case: true
mapperLocations: classpath:mapper/*.xml # 映射xml文件

logging:
level:
com:
chnq:
mybatisdomo: debug
  • 代码块3
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@MapperScan("com.chnq.mybatisdemo.mapper")
public class MybatisDemoApplication {

public static void main(String[] args) {
SpringApplication.run(MybatisDemoApplication.class, args);
}

}
  • 代码块4
// 先指定类型,再赋值
let a: number;
a = 123;
// 指定类型后直接赋值
let b: String = 'hello';
// ts文件中直接指定值,ts会自动判断类型
let c = false;

// 给函数的参数和返回值指定类型
function sum(a: number, b: number): number{ // 第三个number表示返回值的类型
return a + b;
}
  • 代码块5
html, body, #app{
height: 100%;
margin: 0;
padding: 0;
}
  • 代码块6
<table border="1">
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
  • ​引用​

一支穿云箭,千军万马来相见;

  • ​复选框 checkbox​
  • Java
  • Php

bug

  • [标签、分页、归档]这三个子菜单存在问题,在博客根目录​​config.toml​​​中配置如下属性,​​参考​
[taxonomies]
tag = "tags"
category = "categories"
archives = "archives"



标签:manpassant,github,Hugo,boot,博客,chnq,org,hugo,搭建
From: https://blog.51cto.com/chniny/5730204

相关文章

  • 07-Elasticsearch-ES集群搭建
    ElasticSearch集群搭建Elasticsearch集群准备3台虚拟机IP规划192.168.247.142192.168.247.143192.168.247.144三台虚拟机搭建ES建议采用新的机器,我用了之前......
  • Python+Django+Nginx的从0到1的个人网站搭建
    前言本文以实现最终结果为导向,对知识点不做过多阐述。流程中有任何问题请及时面向搜索程序或他人解决问题。一、准备工作Python的下载Python下载地址不会安装的......
  • Docker服务搭建个人音乐播放器Koel
    Koel简介Koel是一种简单的基于Web的个人音频流服务,用客户端的Vue和服务器端的Laravel编写。针对Web开发人员,Koel采用了一些更现代的Web技术来完成其工作搭建步骤doc......
  • 用Vitepress搭建静态网页文档服务器
    1.首先,我们要做的第一件事就是创建目录(在这之前请确保NodeJS已经安装好!)mkdirblog-vitepresscdblog-vitepress2.初始化package.json,并安装viteppressnpminit......
  • Win10 搭建 Ruby on Rails 环境过程
    RubyonRails环境搭建过程注:本博客并非RoR的搭建教程,仅为笔者的尝(瞎)试(搞)过程!前言笔者尝试了在Windows平台上直接下载ruby以及通过WSL搭建RoR环境,最终成功通过CM......
  • 使用 WordPress 本地搭建支持匿名评论的网站
    XAMPP下载这里部署在ContOS上,直接去SourceForge网站下载安装通过MobaXterm/Xshell等终端自带的FTP将下载的xampp-linux-*-installer.run文件发送到ContOS......
  • 搭建漏洞环境及实战——搭建SQL注入平台
    Sqli-lab是一款学习SQL注入的开源平台,共有75种不同类型的注入,复制源码然后将其粘贴到网站的目录中,进入MySQL管理中的PHPMyAdmin,打开http://127.0.0.1/phpMyAdmin/,创建名为......
  • 搭建漏洞环境及实战——在Linux系统中安装LANMP
    LANMP是Linux下Apache、Nginx、mysql和php的应用环境演示的是WDLinux命令:wgethttp://dl.wdlinux.cn/files/lamp_v3.tar.gz从ApacheZooKeeper上下载了ApacheZooKeepe......
  • windows下搭建运行scnuoj
    原文链接:windows下搭建运行scnuoj–每天进步一点点(longkui.site) 0.背景scnuoj是jnoj的更新版本,因为jnoj已经很长时间不维护了,所以scnuoj团队对jnoj进行了简单的改......
  • yii2——windows下搭建yii2框架的安装与运行(1)
    原文链接:yii2——windows下搭建yii2框架的安装与运行(1)–每天进步一点点(longkui.site)本文工具:vscode+phpstudy+composer+php7.3.4可能用到的文章:phpstudy搭建php......