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
已知问题
## 已知问题
- 提交热力图的标签显示没有完全对齐
- 多个可点击元素点击后会出现蓝色的边框
- 移动端模式下点击热力图可能会导致样式错乱
TODO
## TODO
- SEO 优化
- Google Analytics
- 评论
- 自定义菜单
- 更多链接平台支持
@@ -42,26 +42,18 @@ hugo new readme.md
echo '`Hello World!`' > content/readme.md
```
## Setup About page
```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`
## Pin post
```
---
title: "About"
date: 2019-10-22T18:46:47+08:00
layout: "about"
pin: true
---
about me
```
## 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 new posts/title_of_the_post.md
```
@@ -69,6 +61,7 @@ hugo new posts/title_of_the_post.md
## Limit display content
### Approch 1: use summary
```
---
title: "title"
@@ -94,20 +87,22 @@ other content
## add last modified data
Unfortunately, hugo cannot automaticlly get files' modified date, and it needs to be manually set in page as `lastmode`.
```
---
lastmode: 2019-10-22T18:46:47+08:00
---
add to `config.toml`
```toml
lastmod = true
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
```
## 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,28 +119,32 @@ display block $$ ... $$
## config.toml example
```toml
baseURL = "https://example.com/"
title = "GitHub Style"
googleAnalytics = "UA-123-456-789"
baseURL = "https://meik2333.com/"
languageCode = "zh-cn"
title = "MeiK's blog"
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]
author = "example"
description = "example"
github = "example"
facebook = "example"
twitter = "example"
misskey = "user profile url"
mastodon = "user profile url"
email = "example@domain.com"
utterances = "example/example.github.io"
avatar = "https://example.com/images/avatar.png"
url = "https://example.com"
contributions = "post"
author = "MeiK"
github = "MeiK2333"
description = "In solitude, where we are least alone."
twitter = "MeiK2333"
email = "meik2333@gmail.com"
utterances = "MeiK2333/MeiK2333.github.io"
facebook = "MeiK2333"
url = "https://meik2333.com"
keywords = "blog, google analytics"
rss = true
lastmod = true
[frontmatter]
lastmod = ["lastmod", ":fileModTime", ":default"]
```
## 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/).
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"
#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.

View File

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

View File

@@ -1,4 +1,41 @@
<!--
To add an extended head section, please create
`layouts/partials/extended_head.html` in your Hugo directory.
-->
<meta name="description"
content="{{ if .IsHome }}{{ .Site.Params.tagline }}{{ else }}{{ .Summary | plainify }}{{ end }}" />
<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>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<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/github.min.css" | absURL }}" />
<link rel="stylesheet" href="{{ "css/github-style.css" | absURL }}" />
<link rel="stylesheet" href="{{ "css/light.css" | absURL }}" />
<link rel="stylesheet" href="{{ "css/dark.css" | absURL }}" />
<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/github.min.css" | absURL }}' />
<link rel="stylesheet" href='{{ "css/github-style.css" | absURL }}' />
<link rel="stylesheet" href='{{ "css/light.css" | absURL }}' />
<link rel="stylesheet" href='{{ "css/dark.css" | absURL }}' />
<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">
<!-- Extended head section-->
{{ partial "extended_head.html" . }}
</head>