Giter Site home page Giter Site logo

hugo-primer's Introduction

Hugo-Primer

A simple and beautiful Hugo theme based on GitHub's Primer CSS | 日本語記事

This theme would be a perfect fit if you are used to GitHub style pages.
Hugo-Primer is a theme based on GitHub style css: Primer, and adds some blog like features onto it.

Try it now, and leave me a star if you like it!

screenshot

Features

  • Primer css like theme
  • Menu bar header
  • Colored code pen
  • Math inline
  • Awesome TOC
  • Tags & Categories
  • Social Share buttons

Installation

Clone to your theme directory:

git clone https://github.com/qqhann/hugo-primer.git themes/hugo-primer

hugo server --theme=hugo-primer

Usage

exampleSite

You can refer to exampleSite/ to get started. Reading exampleSite/_index.md is good too.

For a quick start:

cp -av themes/hugo-primer/exampleSite/* .

Customizing

config.toml

You can configure Hugo-Primer behavior with these params in your blog's config.toml. Shown are defaults and most recommended configs.

# config.toml

hasCJKLanguage = true
# Code pen
pygmentsCodeFences = true
pygmentsUseClasses = true

# Enter a copyright notice to display in the site footer.
# To display a copyright symbol, type `©`.
copyright = ""

[params]
# Chose Social Sharing Buttons you want to use.
shareTo = ["Twitter", "Hatena", "Facebook", "Pocket"]
# You may disable copyright sentence by setting this to false.
showFooterCredits = true

That being said, below is all recommended configuration example.

# config.toml

baseURL = "https://your_web_site"
title = "Your Blog"
theme = "hugo-primer"
languageCode = "ja"
# If you are using Chinese, Japanese, or Korean, I highly recommend you to set this true.
hasCJKLanguage = true
summaryLength = 70
# Code pen
pygmentsCodeFences = true
pygmentsUseClasses = true
googleAnalytics = "U-12345678-0"

# Enter a copyright notice to display in the site footer.
# To display a copyright symbol, type `©`.
copyright = "©Your Name 2019"

[frontmatter]
# update sitemap.xml's lastmod datetime by file change time, instead of git.
lastmod = ["lastmod", ":fileModTime", ":default"]

[params]
description = "Describe what your web page is about"
twitter = "your_twitter_id"
# You can use favicon by adding `favicon-64.png` to `static` directory.
# You can also add `apple-touch-icon.png` and `pinned-icon.svg`.  
useIcon = true
useTwitterCard = true
# Use MathJax.js. Disabling site-wide and you still can enable in indivisual pages
math = true

shareTo = ["Twitter", "Hatena", "Facebook", "Pocket"]
showFooterCredits = true

archetypes/default.md

It is also recommended to remove your site's archetypes/default.md, or copy Hugo-Primer's archetypes/default.md to your site.

---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
categories:
tags:
keywords:
---

page-level params

hugo-primer also comes with some custom page level parameters

  • showDate (default: true)
    shows the date on a post

  • comments (default: true)
    setting to false will hide disqus comments

  • toc (default: true)
    display the table of contents

  • categories (default: an empty list)
    a list of categories to display in the sidebar

  • tags (default: an empty list)
    a list of tags to display in the sidebar

  • math (default: false)
    If math.js is disabled for the site you can use this setting to enable it for a single page

  • keywords (default: an empty list)
    This adds a metatag to the page for listing keywords. This can be useful for SEO.

Example usage where the defaults are overridden:

---
showdate: false
comments: false
toc: false
categories:
- Diary
tags:
- Shopping
- Health
math: true
keywords:
- Cheese
- Milk
---

ruby annotation

ruby annotation allows you to show pronunciation of characters. Ruby in hugo-primer is like this:

ruby

You just need one line shortcodes code:

{{< ruby rb="深表遗憾" rt="Xi Wen Le Jian" >}}

{{< ruby rb="My heart is broken." rt="I'm happy for that." >}}

Contributing

Issues and PRs are welcome. :)

License

MIT

hugo-primer's People

Contributors

andreyorst avatar cntrump avatar gerrywastaken avatar hakusaro avatar keaising avatar qqpann avatar ragnese avatar undus5 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hugo-primer's Issues

May I add support for ruby tag in HTML

Hi Pan,

I pretty like your theme hugo-primer, it's brief and beautiful.

And I commit a hugo shortcodes to my fork, and it add support for ruby tag in this theme.

You can find the definition of ruby tag in MDN Web docs and my commit in add support for ruby tag in HTML .

The result of ruby tag in hugo-primer is like this:

图片

And you just need one line shortcodes code:

{{< ruby rb="深表遗憾" rt="Xi Wen Le Jian" >}}

{{< ruby rb="My heart is broken." rt="I'm happy for that." >}}

There is an actual view of this shortcodes at the beginning of this post.

Would you like merge this shortcodes into your original repo?

I can make a pull request for that.

Thanks for reading.

Add documentation

Landed here after following a link from the theme site. Could you please add some documentation to this theme? Thanks.

Let TOC appears in search result for better SEO

When writing a huge summary article, it becomes a rather disadvantage because small topics will not show up in search results.
To overcome this, adapt to google's detailed search result with TOC contents.

Change the subtitle?

Thanks for creating this beautiful theme. How do I change or hide the Subtitle of the site? I have shown it with arrow in the image below. It takes the same text of the 'title' inside config.toml file.

I tried using 'Subtitle' inside [params] but it has no effect.

2019-06-11_14-46-49

A scroll bar appears at table of contents

When I refer to this theme, I see the scroll bar in the table of contents:
このテーマを参照した時、目次にスクロールバーを見ます。

This scroll bar is not displayed in IE, but it is displayed in Chrome, Firefox and Edge.
このスクロールバーは IE では表示されませんが、Chrome・Firefox・Edge では表示されています。
This has destroyed the design of the theme.
これにより、テーマのデザインを崩してしまっています。

This solution is a simple CSS addition:
この解決はシンプルなCSSの追加です。

static/assets/style.css

.pr-3 {
  overflow: auto;
}

Add support for code in title

Hello Pan,

When I use code in title, for example:

图片

the result of TOC is broken into three lines, like this:

图片

I try to fix it but I cannot find out where should I modify.

All of us will appreciate it if you can fix it.

如果我的英语没有太讲明白的话,问题是这样的:

在标题里插入代码会造成右上角生成的目录里,插入代码了的那行标题会折成多行。

我尝试自己处理结果没找到地方修改,后端工程师面对css和js很苦手。

不知道是bug还是feature,如果是bug的话麻烦修复,非常感谢!

The name shown in copyright.html should be the author of the website.

Now, what shown in copyright.html is the author of the theme. However, I think it should be the author of the website that uses this theme.

If it goes on like this, readers should misunderstand that "Qiushi Pan" is the author of contents published on the blog that is using this theme.

https://github.com/qqhann/hugo-primer/blob/0df6b6735b69ff808af1055fd540c0463acfa62a/layouts/partials/copyright.html#L1

How do you think about it?

Favicon: Should explain how to add a website icon

# You can use favicon by addin them manually.
useIcon = true

SHOULD BE:

# You can use favicon by addin them manually. 
# (Place an image with filename `favicon-64.png` in `static/`.)
useIcon = true

The date display is wrong

That is a very simple mistake:
それは単純な誤りです。

/layouts/index.html

{{ .Date.Format "2006-01-01" }}

In this way,2018-12-12 will be displayed on December 31, 2018.
これにより、2018年12月31日は 2018-12-12 と表示されています。

Changing the number corresponding to the day will solve it.
日に該当する数字を変える事で解決できるでしょう。

Here it is 2006-01-02:
ここでは 2006-01-02 になっています。
https://gohugo.io/functions/format/

It also exists in this file:
このファイルにも存在します。

TOC not working with Rmd files

Hi,

Thank you for creating this theme. It's simple and works well to my needs. However, I'm having an issue with TOC and Rmd files. I don't have any expriences in web development, so bear with me while I try to explain this:

I'm using Rmd files to compile new posts, but the posts are not displaying the floating TOC correctly: only TOC title are displayed (my post: https://truonghm.github.io/).

I have done my own researches and look at theme source files, and here are my findings:

  1. TOC being included is determined in the file _default/single.html

  2. The HTML output of normal Markdown file has its headings in the following format:

<h3 id="this-is-a-heading">This is a heading</h3>
  1. While the HTML output of R Markdown file has its headings in a different format:
<div id="this-is-a-heading" class="section level3 unnumbered">
<h3>This is a heading</h3>

And as such it looks like the TOC engine doesn't recognize headings from Rmd files to build TOC.

I'm thinking of 2 solutions to this problem:

  1. Change the TOC engine (I haven't figured out its location yet) so that it also recognize a different heading pattern from Rmd

  2. Include some code in the Rmd files so that the headings are produced correctly

I don't have much knowledge regarding HTML/CSS/JS, so it would be a great if you can provide some help.

Thank you again for building the theme!

Edit: This is also the first time I'm submitting an issue on GitHub, and I think the "bug" label does not apply correctly here... Is there any way I can edit this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.