Update README.md

This commit is contained in:
MeiK
2020-12-16 12:04:31 +08:00
parent 4d0bc753f3
commit b8138d659e
4 changed files with 90 additions and 51 deletions

View File

@@ -1,14 +1,14 @@
# github-style # github-style
已知问题 ## 已知问题
- 提交热力图的标签显示没有完全对齐 - 提交热力图的标签显示没有完全对齐
- 多个可点击元素点击后会出现蓝色的边框 - 多个可点击元素点击后会出现蓝色的边框
- 移动端模式下点击热力图可能会导致样式错乱 - 移动端模式下点击热力图可能会导致样式错乱
TODO ## TODO
- SEO 优化 - Google Analytics
- 评论 - 评论
- 自定义菜单 - 自定义菜单
- 更多链接平台支持 - 更多链接平台支持
@@ -42,26 +42,18 @@ hugo new readme.md
echo '`Hello World!`' > content/readme.md echo '`Hello World!`' > content/readme.md
``` ```
## Setup About page ## Pin post
```bash
hugo new about.md
```
This creates content/about.md file. Then add `layout = "about"` to `content/about.md`, and remove the line `draft:true`
``` ```
--- ---
title: "About" pin: true
date: 2019-10-22T18:46:47+08:00
layout: "about"
--- ---
about me
``` ```
## Add new posts ## Add new posts
Hugo will create a post with `draft: true`, change it to false in order for it to show in the website.
Hugo will create a post with `draft: true`, change it to false in order for it to show in the website.
``` ```
hugo new posts/title_of_the_post.md hugo new posts/title_of_the_post.md
``` ```
@@ -69,6 +61,7 @@ hugo new posts/title_of_the_post.md
## Limit display content ## Limit display content
### Approch 1: use summary ### Approch 1: use summary
``` ```
--- ---
title: "title" title: "title"
@@ -94,20 +87,22 @@ other content
## add last modified data ## add last modified data
Unfortunately, hugo cannot automaticlly get files' modified date, and it needs to be manually set in page as `lastmode`. add to `config.toml`
```
--- ```toml
lastmode: 2019-10-22T18:46:47+08:00 lastmod = true
---
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
``` ```
## Support LaTex ## Support LaTex
In you post add `katex:true` to [front matter](https://gohugo.io/content-management/front-matter/) In you post add `math: true` to [front matter](https://gohugo.io/content-management/front-matter/)
``` ```
--- ---
katex: true katex: math
--- ---
``` ```
@@ -124,29 +119,33 @@ display block $$ ... $$
## config.toml example ## config.toml example
```toml ```toml
baseURL = "https://example.com/" baseURL = "https://meik2333.com/"
title = "GitHub Style" languageCode = "zh-cn"
googleAnalytics = "UA-123-456-789" title = "MeiK's blog"
theme = "github-style" theme = "github-style"
copyright = "© 2019. Theme by <a href=\"https://github.com/MeiK2333/github-style\"><span>github-style</span></a>" googleAnalytics = "UA-123456-789"
[params] [params]
author = "example" contributions = "post"
description = "example" author = "MeiK"
github = "example" github = "MeiK2333"
facebook = "example" description = "In solitude, where we are least alone."
twitter = "example" twitter = "MeiK2333"
misskey = "user profile url" email = "meik2333@gmail.com"
mastodon = "user profile url" utterances = "MeiK2333/MeiK2333.github.io"
email = "example@domain.com" facebook = "MeiK2333"
utterances = "example/example.github.io" url = "https://meik2333.com"
avatar = "https://example.com/images/avatar.png"
url = "https://example.com"
keywords = "blog, google analytics" keywords = "blog, google analytics"
rss = true
lastmod = true
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
``` ```
## deploy.sh example ## deploy.sh example
There are various way to deploy to github, here is a link to official [document](https://gohugo.io/hosting-and-deployment/hosting-on-github/).
There are various way to deploy to github, here is a link to official [document](https://gohugo.io/hosting-and-deployment/hosting-on-github/).
Here is an sample. Note line 22 have `env HUGO_ENV="production"`, makes sure googleAnalysis is loaded during production, but is not loaded when we are testing it in localhost. Here is an sample. Note line 22 have `env HUGO_ENV="production"`, makes sure googleAnalysis is loaded during production, but is not loaded when we are testing it in localhost.
@@ -180,4 +179,5 @@ cd public && git add --all && git commit -m "Publishing to gh-pages (publish.sh)
#echo "Pushing to github" #echo "Pushing to github"
#git push --all #git push --all
``` ```
Then you can verify the site is working and use `git push --all` to push the change to github. If you don't want to check again every time, you can uncomment the `#git push --all` in the script. Then you can verify the site is working and use `git push --all` to push the change to github. If you don't want to check again every time, you can uncomment the `#git push --all` in the script.

View File

@@ -2,7 +2,6 @@ baseURL = "https://meik2333.com/"
languageCode = "zh-cn" languageCode = "zh-cn"
title = "MeiK's blog" title = "MeiK's blog"
theme = "github-style" theme = "github-style"
pygmentsCodeFences = true
googleAnalytics = "UA-123456-789" googleAnalytics = "UA-123456-789"
[params] [params]

View File

@@ -1,4 +1,41 @@
<!-- <meta name="description"
To add an extended head section, please create content="{{ if .IsHome }}{{ .Site.Params.tagline }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
`layouts/partials/extended_head.html` in your Hugo directory. <meta name="keywords"
--> content='{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}' />
<meta name="robots" content="noodp" />
<link rel="canonical" href="{{ .Permalink }}" />
<!-- Twitter Card -->
<meta name="twitter:card" content="summary" />
<meta name="twitter:title" content="{{ if .IsHome }}{{ else }}{{ .Title }} - {{ end }}{{ .Site.Title }}" />
<meta name="twitter:description"
content="{{ if .IsHome }}{{ $.Site.Params.description }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta name="twitter:site" content="{{ $.Site.BaseURL }}" />
<meta name="twitter:creator" content="{{ .Params.Author }}" />
<meta name="twitter:image"
content="{{ if .IsHome }}{{ $.Site.Params.avatar | absURL }}{{ else }}{{ .Params.Cover | absURL }}{{ end }}">
<!-- OG data -->
<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" />
<meta property="og:title" content="{{ if .IsHome }}{{ else }}{{ .Title }} - {{ end }}{{ .Site.Title }}">
<meta property="og:description"
content="{{ if .IsHome }}{{ $.Site.Params.description }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<meta property="og:url" content="{{ .Permalink }}" />
<meta property="og:site_name" content="{{ .Title }}" />
<meta property="og:image"
content="{{ if .IsHome }}{{ $.Site.Params.avatar | absURL }}{{ else }}{{ .Params.Cover | absURL }}{{ end }}">
<meta property="og:image:width" content="2048">
<meta property="og:image:height" content="1024">
{{ if isset .Params "date" }}
<meta property="article:published_time" content="{{ time .Date }}" />
{{ end }}
<!-- RSS -->
{{ with .OutputFormats.Get "RSS" }}
<link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" />
{{ end }}
<!-- JSON Feed -->
{{ with .OutputFormats.Get "json" }}
<link href="{{ .RelPermalink }}" rel="alternate" type="application/json" title="{{ $.Site.Title }}" />
{{ end }}

View File

@@ -1,13 +1,16 @@
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=device-width"> <meta name="viewport" content="width=device-width">
<script type="application/javascript" src="{{ "js/theme-mode.js" | absURL }}"></script> <script type="application/javascript" src='{{ "js/theme-mode.js" | absURL }}'></script>
<link rel="stylesheet" href="{{ "css/frameworks.min.css" | absURL }}" /> <link rel="stylesheet" href='{{ "css/frameworks.min.css" | absURL }}' />
<link rel="stylesheet" href="{{ "css/github.min.css" | absURL }}" /> <link rel="stylesheet" href='{{ "css/github.min.css" | absURL }}' />
<link rel="stylesheet" href="{{ "css/github-style.css" | absURL }}" /> <link rel="stylesheet" href='{{ "css/github-style.css" | absURL }}' />
<link rel="stylesheet" href="{{ "css/light.css" | absURL }}" /> <link rel="stylesheet" href='{{ "css/light.css" | absURL }}' />
<link rel="stylesheet" href="{{ "css/dark.css" | absURL }}" /> <link rel="stylesheet" href='{{ "css/dark.css" | absURL }}' />
<title>{{ if .IsHome }}{{ else }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title> <title>{{ if .IsHome }}{{ else }}{{ .Title }} - {{ end }}{{ .Site.Title }}</title>
<link rel="icon" type="image/x-icon" href="{{ "images/favicon.ico" | absURL }}"> <link rel="icon" type="image/x-icon" href='{{ "images/favicon.ico" | absURL }}'>
<meta name="theme-color" content="#1e2327"> <meta name="theme-color" content="#1e2327">
<!-- Extended head section-->
{{ partial "extended_head.html" . }}
</head> </head>