diff --git a/README.md b/README.md index 11258c5..0ec93c6 100644 --- a/README.md +++ b/README.md @@ -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 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,29 +119,33 @@ 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 github-style" +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/). + +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. diff --git a/config.template.toml b/config.template.toml index 2e80c57..1678239 100644 --- a/config.template.toml +++ b/config.template.toml @@ -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] diff --git a/layouts/partials/extended_head.html b/layouts/partials/extended_head.html index 846ff9c..50ab133 100644 --- a/layouts/partials/extended_head.html +++ b/layouts/partials/extended_head.html @@ -1,4 +1,41 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + +{{ if isset .Params "date" }} + +{{ end }} + + +{{ with .OutputFormats.Get "RSS" }} + +{{ end }} + + +{{ with .OutputFormats.Get "json" }} + +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 85be49b..4281152 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -1,13 +1,16 @@
- - - - - - + + + + + +