Giter Club home page Giter Club logo

hugo-theme-pure's Introduction

hugo-theme-pure

A port of hexo-theme-pure for Hugo. Powerful & Clean. Iconfont

简体中文

Contribute

Since I mainly do back-end development, I don’t know anything about the front-end (CSS or something). It’s a hard-hitting transplant. Some of the features that I like very much don’t know how to add it. It’s a waste of time to study too long, so If you have a very good feature and hope to put it up, it would be best.

The file structure of repo is roughly referred to hexo-theme-pure and should be clearer. It can be modified according to your needs. If you look at the file structure a little, you will find that the function has not been implemented.

Changelog

  1. [2019-11-19] Add mainSections param to avoid hard code.You can set this param to choose which directory under your content folder you want to render. posts by default. You can also unset it,but there seems have some problem.

  2. [2019-11-19] Support MathJax(PR) Reference:MathJax-With-Hugo& Upgrade jQuery version(PR).

    e.g.

    $$\begin{cases}
    a_1x+b_1y+c_1z=d_1\\
    a_2x+b_2y+c_2z=d_2\\
    a_3x+b_3y+c_3z=d_3\\
    \end{cases}
    $$
    not-set-mmark set-mmark
  3. [2019-12-07] beautify toc by tocbot

  4. [2019-12-24] support pagination

  5. [2019-12-31]

    1. support highlight shortcode Note: Just compatible with basic highlight usage like:

      {{< highlight go >}}
      // ... code
      {{< / highlight >}}

    If you use hugo official example like,rendering will be very ugly.I don't want to compatible with it or maybe you want. Don't forget send a pr~ thanks.

     {{< highlight go "linenos=table,hl_lines=8 15-17,linenostart=199" >}}
     // ... code
     {{< / highlight >}}
    1. Minify css&js file.

Screenshots

Installation

$ cd $HUGO_ROOT
$ git clone https://github.com/xiaoheiAh/hugo-theme-pure themes/pure
$ ./hugo server -t pure

Note

  1. Please copy the config.yml under the exampleSite folder to the root folder of your Hugo Site. Feel free to change it. If you don't like .yml file, you can also convert it to you want.

  2. Your post should under the posts folder, like this : hugo new posts/any.md

Multilingual

Translations are collected from the themes/even/i18n/ folder (built into the theme), as well as present in i18n at your root of project.

You can specify defaultContentLanguage to use translations.

defaultContentLanguage: zh # en,fr...

Currently supports English and Chinese, you can see en.yml and zh.yml under pure/i18n. If you want to support other language, you can copy any yml file under i18n and rename to new language, then feel free to translate.

Favicon & Images

You should put you images into static folder at your root project. When specify favicon or donate qr code , don't use absolute url like /favicon.ico, please use relative url like favicon.ico or donate/alipay.png

Menu Icons

You can configure the menu according to the icons of Iconfont, the following is configuration.

menuIcons:
  enable: true  
  home: icon-home-fill
  archives: icon-archives-fill
  categories: icon-folder
  tags: icon-tags
  repository: icon-project
  books: icon-book-fill
  links: icon-friendship
  about: icon-cup-fill

TOC

enable toc

  # config
  config:
    toc: true

TODO

  • TOC
  • pagination

License

Released under the MIT License.

Acknowledgements

hugo-theme-pure's People

Contributors

anbuchelva avatar holtenko avatar jayele avatar kbyyd24 avatar makeding avatar miska avatar onedrawingperday avatar sparsick avatar ssbarnea avatar stefanji avatar tylerburleigh avatar udit-001 avatar xiaoheiah avatar yantonov 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  avatar

hugo-theme-pure's Issues

toc: true不起作用

您好,非常喜欢您的主题。有个疑问,这样配置:
config:
toc: true
文章目录好像没有作用,请问是还要配置其它地方吗?

allow us to diable sidebar

We should be able to disable sidebar in various pages by adding something like

---
layout: page
sidebar: false
---
....

At this moment I was not able to find any way to disable the sidebar on specific pages.

启动的时候提示failed to render pages

报错信息:
Error: Error building site: failed to render pages: render of "section" failed: "/root/hillsbird/themes/hugo-theme-pure/layouts/_default/list.html:11:55": execute of template failed: template: _default/list.html:11:55: executing "content" at <$.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState
这是啥意思?

Upgrade jquery from deprecated version 1.12.x to 3.4.1.

The theme uses an outdated version of jquery which is now considered to have security issues. We should migrate to a supported version (3.4.1). You can use jquery-migrate, I have already tested it though and it doesn't issue any warnings, if you'd like, I can send in a pull request making the suggested changes.

启动Hugo服务报错:range can't iterate over

错误信息:

ERROR 2019/12/30 12:53:52 render of "page" failed: "/Users/hadyang/Documents/hadyang.github.io/themes/pure/layouts/_default/single.html:4:12": execute of template failed: template: _default/single.html:4:6: executing "content" at <partial "article.html" .>: error calling partial: "/Users/hadyang/Documents/hadyang.github.io/themes/pure/layouts/partials/article.html:4:12": execute of template failed: template: partials/article.html:14:12: executing "partials/article.html" at <partial "post/category.html" .>: error calling partial: "/Users/hadyang/Documents/hadyang.github.io/themes/pure/layouts/partials/post/category.html:4:12": execute of template failed: template: partials/post/category.html:4:12: executing "partials/post/category.html" at <.>: range can't iterate over Java

Hugo版本:
Hugo Static Site Generator v0.62.0/extended darwin/amd64 BuildDate: unknown

配置文件:

baseURL: https://hadyang.github.io/
languageCode: zh-CN
title: HadYang
theme: pure
defaultContentLanguage: zh  # en/zh/...
footnoteReturnLinkContents: ↩
hasCJKLanguage: true
paginate: 7
enableEmoji: true
permalinks:
  posts: /:year/:month/:filename/

taxonomies:
    category : categories
    tag : tags
    series : series

outputFormats:          # use for search. recommend not to modify 
  SearchIndex:
    mediaType: "application/json"
    baseName: "searchindex"
    isPlainText: true
    notAlternative: true

outputs:
    home: ["HTML","RSS","SearchIndex"]  # recommend not to modify
# sitemap
sitemap:
  changefreq: monthly
  filename: sitemap.xml
  priority: 0.5

menu:
  main:
    - identifier: home
      name: Home
      weight: 1
      url: /
    - identifier: tags
      name: Tags
      weight: 2
      url: /tags
    - identifier: categories
      name: Categories
      weight: 3
      url: /categories
  # Sidebar only the following widgets. you can remove any you don't like it.

params:
  since: 2017
  dateFormatToUse: "2006-01-02"
  enablePostCopyright: true
  # the directory under content folder that you want to render
  mainSections: ["posts"]
  # Enable/Disable menu icons
  # Icon Reference: http://blog.cofess.com/hexo-theme-pure/iconfont/demo_fontclass.html
  enableMathJax: true #Enable mathjax support, to use mathematical notations
  highlightjs:
    langs: ["python", "javascript"] # refer to http://staticfile.org/, search highlight.js, already have highlight.min.js

  menuIcons:
    enable: true  # 是否启用导航菜单图标
    home: icon-home-fill
    archives: icon-archives-fill
    categories: icon-folder
    tags: icon-tags
    repository: icon-project
    books: icon-book-fill
    links: icon-friendship
    about: icon-cup-fill

  # profile
  profile:
    enabled: true # Whether to show profile bar
    avatar: avatar.png
    gravatar: # Gravatar email address, if you enable Gravatar, your avatar config will be overriden
    author: xiaoheiAh
    author_title: author title
    author_description: Good Good Study, Day Day Up~
    location: Shanghai, China
    follow: https://github.com/xiaoheiAh
    # Social Links
    social:
      links:
        github: https://github.com/xiaoheiAh
        # weibo: http://weibo.com/{yourid}
        # twitter: https://twitter.com/
        # facebook: /
        rss: /index.xml
      link_tooltip: false # enable the social link tooltip, options: true, false
  # Site
  site:
    logo:
      enabled: true
      width: 40
      height: 40
      url: favicon.ico
    title: Hugo # 页面title
    favicon: favicon.ico
    board: <p>enjoy~</p> # 公告牌

  # Share
  # weibo,qq,qzone,wechat,tencent,douban,diandian,facebook,twitter,google,linkedin
  share:
    enable: true # 是否启用分享
    sites: weibo,qq,wechat,facebook,twitter # PC端显示的分享图标
    mobile_sites: weibo,qq,qzone # 移动端显示的分享图标

  # Comment
  comment:
    type:  # type disqus/gitalk/valine 启用哪种评论系统
    disqus: your_disqus_name # enter disqus shortname here
    gitalk: # gitalk. https://gitalk.github.io/
      owner: #必须. GitHub repository 所有者,可以是个人或者组织。
      admin: #必须. GitHub repository 的所有者和合作者 (对这个 repository 有写权限的用户)。
      repo:  #必须. GitHub repository.
      ClientID: #必须. GitHub Application Client ID.
      ClientSecret: #必须. GitHub Application Client Secret.
    valine: # Valine. https://valine.js.org
      appid: # your leancloud application appid
      appkey: # your leancloud application appkey
      notify: # mail notifier , https://github.com/xCss/Valine/wiki
      verify: # Verification code
      placeholder: enjoy~ # comment box placeholder
      avatar: mm # gravatar style
      meta: nick,mail # custom comment header
      pageSize: 10 # pagination size
      visitor: false # Article reading statistic https://valine.js.org/visitor.html

  # Donate
  donate:
    enable: false
    # 微信打赏
    wechatpay:
      qrcode: donate/wechatpayimg.png
      title: 微信支付
    # 支付宝打赏
    alipay:
      qrcode: donate/alipayimg.png
      title: 支付宝

  # PV
  pv:
    busuanzi:
      enable: false # 不蒜子统计
    leancloud:
      enable: false # leancloud统计
      app_id: # leancloud <AppID>
      app_key: # leancloud <AppKey>

  # wordcount
  postCount:
    enable: true
    wordcount: true # 文章字数统计
    min2read: true # read time 阅读时长预计

  # config
  config:
    skin: # theme color default is white. other type [theme-black,theme-blue,theme-green,theme-purple]
    layout: main-center # main-left main-center main-right
    excerpt_link: Read More
    toc: true

  # Sidebar
  sidebar: right

  # Search
  search:
    enable: true # enable search. thanks for https://raw.githubusercontent.com/ppoffice/hexo-theme-icarus/master/source/js/insight.js

  # Sidebar only the following widgets. you can remove any you don't like it.
  widgets:
    - board
    - category
    - tag
    - recent_posts

params:
 email: [email protected]
 github: https://github.com/hadyang
 image: resources/img/IMG_3162.JPG

math rendering?

How do you set up math rendering??

hugo new site folder
cd folder
git clone <repo> ./themes/pure

copied config.yml from exampleSite

hugo new posts/test.mmark
echo \$\$a+b=c\$\$ >> ./content/posts/test.mmark
hugo server -D

but math renders as \(a+b=c\)

Also /layouts/partials/math.html in the repo calls mathjax instead of katex, contrary to what instructions say.

Am I missing something?

MathJax config needs to be added.

So there are some basic settings that need to be configured for MathJax to run on production, I took a look at the hugo docs, the major setting that needs to be added is the support for mmark files :

<script type="text/x-mathjax-config">
      MathJax.Hub.Config({
              showMathMenu: false, //disables context menu
              tex2jax: {
              inlineMath: [ ['$','$'], ['\\(','\\)'] ]
             }
      });
</script>

多语言无法使用

defaultContentLanguage: zh 设置了之后还是英文界面 需要什么其他的设置么

When uglyurls = true

I have came across that when you enable uglyurl = "true"

post/category.html
post/tags.html

Does not append the .html to the URLs.

404 page not found

When I went through the files I saw a 404.html file but it didn't seem to have anything it it, do you have any plans on adding a 404 page to this theme?

Disqus embed not working

Hello,

Thank you for your theme. I'm trying to setup disqus, but it seems to not inject disqus' js code.

site: https://sathyasays.com/
config: https://github.com/SathyaBhat/sathyasays.com/blob/master/config.yml#L128-L129

Looking at the source, I can see the comment section is added

<section id="comments">
    <div id="disqus_thread">
        <noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
    </div>
</section>

which means

https://github.com/xiaoheiAh/hugo-theme-pure/blob/master/layouts/partials/post/comment.html#L4-L7

is working but I don't know why

https://github.com/xiaoheiAh/hugo-theme-pure/blob/master/layouts/partials/_script/comment.html#L25-L36

is not getting evaluated.

Any help is appreciated

hide missing dates from posts

If you do not mention the article date a default 0001-01-01 is rendered which is at least ugly.

Some pages may not need a date and I think that the default behaviour should be to hide the date if is invalid.

This is very important for the article view where date is displayed in a very visible place. For other places like archive that is less important. Still, even in this case if rendering the date as an empty string could improve the visual look.

备案信息

您好,config.yml添加字段customFooter,但是备案信息并没有显示出来?

tags do not wrap

It seems that the list of tags does not wrap, making the tags page look really broken. Obviously that this occurs only when you define more than a couple of tags. They should act as spans not as divs.

tags-ss

PS. Url of page /tags/ansible-lint/

Icons padding issue.

Icons do not seem to have any sort of padding for me and are clinging to the text adjacent to it.
Icon

multi-tag search

Please add the ability to search not by one, but by several tags.
Since different articles may overlap with the same tags, but different topics.

todo建议

  • 文章页面TOC
  • 代码高亮最好标记出是什么语言

Category index page is missing slash

I am using htmltest to validate the build output and I found what it appears to be a bug in theme:

htmltest started at 01:37:11 on public
========================================================================
running in concurrent mode, this is experimental
categories/romanian/index.html
  target is a directory, href lacks trailing slash --- categories/romanian/index.html --> /categories
categories/tools/index.html
  target is a directory, href lacks trailing slash --- categories/tools/index.html --> /categories
categories/devops/index.html
  target is a directory, href lacks trailing slash --- categories/devops/index.html --> /categories
categories/i18n/index.html
  target is a directory, href lacks trailing slash --- categories/i18n/index.html --> /categories
categories/molecule/index.html
  target is a directory, href lacks trailing slash --- categories/molecule/index.html --> /categories
categories/ansible/index.html
  target is a directory, href lacks trailing slash --- categories/ansible/index.html --> /categories
categories/python/index.html
  target is a directory, href lacks trailing slash --- categories/python/index.html --> /categories
categories/usability/index.html
  target is a directory, href lacks trailing slash --- categories/usability/index.html --> /categories
========================================================================

I may make sense to run htmltest on example site as part of the CI testing to assure that that theme output is "more" valid ;)

Remove links in the end of the page

Hi, is there a way to remove :

本文链接:http://localhost:1313
版权声明:xx,均采用 CC BY 4.0 CN协议 许可协议。转载请注明出处!

In the end of the page?

Shortcode broken and some customization problems

New to hugo. I met problems in such:
1/ Instagram API is broken with
Failed to get JSON resource "https://api.instagram.com/oembed/?url=https://instagram.com/p/BGvuInzyFAe/&hidecaption=1": Get https://api.instagram.com/oembed/?url=https://instagram.com/p/BGvuInzyFAe/&hidecaption=1
Also the twitter/ Vimeo not working( only youtube still working)
I want to fix it but I can not find option/ code. ( I know it is shortcode not working but not knowing how to fix )

2/ How can I change the font size in article pages?
I want my article's main body font much larger (including markdown headings/ quote/ code fence etc. Is it possible in this theme?

3/ How can I disable tags globally?
I have disabled tags in the two sidebars, I want to disable it below the title.

Apostrophes create weird breaks in lines

On the text, "I did note that, out of the box, LINQ’s IEnumerable.Any doesn’t do any optimization," both apostrophes generate weird spacing in the output text.

Looking at the underlying generated html, the spacing appears to be caused by a element being generated.

归档界面收缩bug

在归档界面,以你的demo为例子,就是 https://xiaohei.im/hugo-theme-pure/posts/ 这个界面,如果文章的日期有2019年、2018年...,点击图标收缩,只有最上面的一个年份能收缩,而且是收缩全部年份的文章,点击2018年的图标,收缩功能无效。
image

Use of lastBuildDate makes output non ideponent

Because the rss.xml is using lastBuildDate which always change all xml files are recreated and thus needing deployment.

That date should be the date of the last commit instead of .Date.Format which varies too much.

Building site twice should not report any changed files.

Another idempotency breaking comes from sitemap.xml where order of seems not to be consistent, at least for the categories, where I seen random changes. Probably cased by an unsorted dictionary.

support for github sponsorhip

It would be useful to add support for github sponsorship in addition to the other two existing options. Also you may want to enable it for your theme repo too.

Post nav string problem.

Referring to the following code:

The nav links have their strings swapped, the text should be as follows:

  • Prev arrow should have the string 'nav_older'
  • Next arrow should have the string 'nav_newer'

archive creates collection for current year only

The archive page: all posts in the same year are grouped together

I started using your theme at the end of last year, and created a number of posts. in the new year, I've now created two more posts, and all posts from last year are each listed in their own group, and the 2 posts from this year are in the same group.

If I change the posts from 2020 to drafts, all the posts from 2019 are all grouped together again. is this easily configurable from my side, or is this a change on the theme's side?

"Search" still not functioning with CORS blocking

Error msg: Access to XMLHttpRequest at 'https://nyte-bk201.github.io/searchindex.json' from origin 'http://nyte.xyz' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Search functioning in your site with local resources sharing but it fails when hosting in GitHub pages with domain set. Check http://nyte.xyz/ if you want more info.
I try to fix but not familiar with back-end dev.

Error: "can't evaluate field RegularPages"

I get these errors when trying to build using hugo 0.62.0:

Building sites … ERROR 2019/12/30 20:18:53 render of "taxonomyTerm" failed: "C:\Users\tyler\Documents\tylerburleigh.github.io_source\themes\pure\layouts\_default\list.html:6:61": execute of template failed: template: _default\list.html:6:61: executing "content" at <.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState
ERROR 2019/12/30 20:18:53 render of "section" failed: "C:\Users\tyler\Documents\tylerburleigh.github.io_source\themes\pure\layouts\_default\list.html:6:61": execute of template failed: template: _default\list.html:6:61: executing "content" at <.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState
Total in 797 ms
Error: Error building site: failed to render pages: render of "section" failed: "C:\Users\tyler\Documents\tylerburleigh.github.io_source\themes\pure\layouts\_default\list.html:6:61": execute of template failed: template: _default\list.html:6:61: executing "content" at <.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState
WARN 2019/12/30 20:18:57 Module "pure" is not compatible with this Hugo version; run "hugo mod graph" for more information.
Building sites … ERROR 2019/12/30 20:18:57 render of "section" failed: "C:\Users\tyler\Documents\tylerburleigh.github.io_source\themes\pure\layouts\_default\list.html:6:61": execute of template failed: template: _default\list.html:6:61: executing "content" at <.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState
ERROR 2019/12/30 20:18:57 render of "taxonomyTerm" failed: "C:\Users\tyler\Documents\tylerburleigh.github.io_source\themes\pure\layouts\_default\list.html:6:61": execute of template failed: template: _default\list.html:6:61: executing "content" at <.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState
Total in 629 ms
Error: Error building site: failed to render pages: render of "section" failed: "C:\Users\tyler\Documents\tylerburleigh.github.io_source\themes\pure\layouts\_default\list.html:6:61": execute of template failed: template: _default\list.html:6:61: executing "content" at <.RegularPages>: can't evaluate field RegularPages in type *hugolib.pageState

只有首页才被正常渲染的问题(含办法)

@xiaoheiAh
具体说应该不能叫做问题,是一个新手很有可能犯的小差错。
具体情况如下

在把themes中exampleSite中的config.yml文件覆盖到站点根目录后,如果直接hugo -t pure 命令渲染的话会出现只有站点的首页才被正确渲染,而其他链接点击后可以跳转但是页面没有被完整渲染。

解决方法如下

把复制出来的config文件中第一行中的 bashURL: http://example.com/ 改为 bashURL: / 保存后重新渲染一边即可解决。希望作者能把这个提示也加在readme.md 的两个版本中,后来者也能少走弯路

最后,感谢作者的辛苦付出~ 👍

Error building site

`Building sites … ERROR 2019/12/27 15:08:31 render of "taxonomyTerm" failed: execute of template failed: template: _default/category.terms.html:30:46: executing "_default/category.terms.html" at <len .Site.Params.mainsections>: error calling len: len of untyped nil

ERROR 2019/12/27 15:08:31 render of "home" failed: execute of template failed: template: index.html:30:46: executing "index.html" at <len .Site.Params.mainsections>: error calling len: len of untyped nil
Total in 11 ms

Error: Error building site: failed to render pages: render of "taxonomyTerm" failed: execute of template failed: template: _default/tag.terms.html:30:46: executing "_default/tag.terms.html" at <len .Site.Params.mainsections>: error calling len: len of untyped nil
`

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.