Giter Site home page Giter Site logo

caijinglong / maupassant-hugo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from flysnow-org/maupassant-hugo

0.0 2.0 0.0 585 KB

Maupassant theme, ported to Hugo. Forked from JokerQyou.

Home Page: http://www.flysnow.org/

License: MIT License

HTML 31.92% CSS 67.64% JavaScript 0.44%

maupassant-hugo's Introduction

Maupassant

Maupassant theme, ported to Hugo.

  1. 预览效果:飞雪无情的博客
  2. English Docs

一款非常简洁、性能高的Hugo主题,适配不同的设备(PC,Mobile等)。 主要是基于 Typecho Cho, 从 JokerQyou forked,修改和添加了很多功能而成,如GA统计、最近的文章、标签云、自定义菜单、按日期归档等 .

Preview

Maupassant 主题预览

功能特性

  1. 最近发表的文章支持,显示最近的10篇
  2. 分类支持,并且可以显示分类内的文章数量
  3. 标签云支持
  4. 一键回到页面顶部
  5. RSS支持,并且可以自动发现RSS
  6. 自定义菜单支持,不限个数,自定义排序
  7. 自定义友情链接支持
  8. 支持文章按年份日期进行归档
  9. 支持GA分析统计
  10. sitemap站点地图
  11. 代码高亮
  12. 404错误页
  13. 支持关键字SEO优化
  14. Google站内搜索
  15. See Also 支持
  16. Disqus评论支持
  17. 不蒜子页面计数器支持
  18. 自定义css、js
  19. utteranc评论
  20. 部分自定义的shortcode

下载安装

cd <YOUR Bolg Root Dir>
git clone https://github.com/rujews/maupassant-hugo themes/maupassant

配置

应用主题

theme = "maupassant"

基本配置

baseURL = "http://www.flysnow.org"
languageCode = "zh-CN"
title = "飞雪无情的博客"
theme = "maupassant"

[author]
  name = "飞雪无情"

[params]
  author = "飞雪无情"
  subtitle = "专注于Android、Java、Go语言(golang)、移动互联网、项目管理、软件架构"
  keywords = "golang,go语言,go语言笔记,飞雪无情,java,android,博客,项目管理,python,软件架构,公众号,小程序"
  description = "专注于IT互联网,包括但不限于Go语言(golang)、Java、Android、Python、项目管理、抖音分析、软件架构等"

基本配置大家都比较熟悉,这是我的博客的配置,仅供参考。

自定义菜单

[menu]

  [[menu.main]]
    identifier = "books"
    name = "新书"
    url = "/books/"
    weight = 2

  [[menu.main]]
    identifier = "archives"
    name = "归档"
    url = "/archives/"
    weight = 3

  [[menu.main]]
    identifier = "about"
    name = "关于"
    url = "/about/"
    weight = 4

identifier标志符必须是唯一的,不能重复;weight用于排序,值越小越靠前。

友情链接

[[params.links]]
  title = "Android Gradle权威指南"
  name = "Android Gradle权威指南"
  url = "http://yuedu.baidu.com/ebook/14a722970740be1e640e9a3e"
[[params.links]]
  title = "常用开发工具CDN镜像"
  name = "常用开发工具CDN镜像"
  url = "http://mirrors.flysnow.org/"

params.links是一个数组,所以我们可以自定义很多友情链接。name表示显示的链接文本,title表示鼠标悬停在友情链接时,显示的文本。

广告模块

广告模块在侧边栏,可以灵活配置,让博主可以放一些超链接广告、或者图片链接广告。

[[params.ads]]
  title = "领取¥1888阿里云产品通用代金券"
  url = "https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=jdg9oj97"

[[params.ads]]
  title = "领取¥1888阿里云产品通用代金券"
  url = "https://promotion.aliyun.com/ntms/act/vmpt/aliyun-group/home.html?userCode=jdg9oj97"
  img = "https://img.alicdn.com/tfs/TB17qJhXpzqK1RjSZFvXXcB7VXa-200-126.jpg"
[[params.ads]]
  title = "领取¥1888阿里云产品通用代金券"
  url = "https://promotion.aliyun.com/ntms/act/enterprise-discount.html?userCode=jdg9oj97"
  img = "https://img.alicdn.com/tfs/TB1aDXhXpzqK1RjSZFvXXcB7VXa-259-194.jpg"

params.ads是一个数组,所以我们可以自定义很多广告。如果img存在,则优先使用图片广告,title表示鼠标悬停在广告链接时,显示的文本。

具体效果参考 http://www.flysnow.org/

添加GA分析统计

该主题已经支持了GA分析统计,只需要在config.toml配置里加入如下配置即可。

googleAnalytics = "GA ID"

文章归档支持

Hugo默认是不支持生成归档文件的,需要自己实现。该主题已经实现了文章归档,只需要在新建content/archives/index.md文件,文件内容为:

title: "归档"
description: Android资深工程师 ,Go和Java打杂师,《Android Gradle权威指南》作者,Android官方技术文档译者
type: archives

titledescription都可以换成你自己的,但是type必须是archives

content/archives/index.md表示在content/archives/目录下的index.md文件

Disqus

该主题支持Disqus评论,如果要启用Disqus,可以在config.toml里添加如下配置即可.

disqusShortname = "yourdiscussshortname"

utteranc

该主题支持utteranc评论,这是一个基于Github Issue的评论系统,使用方便,不用翻墙即可评论。 可以在config.toml里添加如下配置即可.更多详见 https://utteranc.es

[params.utteranc]
    enable = true
    repo = ""    # 存储评论的Repo,格式为 owner/repo
    issueTerm = "pathname"  #表示你选择以那种方式让github issue的评论和你的文章关联。
    theme = "github-light" # 样式主题,有github-light和github-dark两种

对于以上issueTerm可以选择的配置有

  1. pathname 以路径的方式,推荐选项,这样你换域名的时候就不用担心评论找不到了
  2. url 全链接URL路径的方式。
  3. title 按页面title标题的方式。

其他还有几个不常用,这里就不再赘述了。

不蒜子页面计数器支持

该主题支持不蒜子这个极简的页面计数器支持,如果要启用不蒜子,可以在config.toml里添加如下配置即可.

[params]
  busuanzi = true

替换成你自己的Disqus名字即可。

禁止分类的名称转为小写

我们在写文章的时候,会给文章进行分类,比如Golang,但是默认情况下,Hugo会把这个Golang转为小写, 这就我们一直用原始字符的造成困扰,为了解决这个问题,Hugo提供了preserveTaxonomyNames配置,把它设置为true就可以了保持原来分类的名字了。

## 保持分类的原始名字(false会做转小写处理)
preserveTaxonomyNames = true

禁止URL路径小写

默认情况下,URL字符串里的字母都是小写的,这对于分类名、标签名是大写的来说,博客迁移后(比如从Hexo到Hugo),原来的链接就失效了, 为了解决这个问题,Hugo提供了disablePathToLower配置。

## 是否禁止URL Path转小写
disablePathToLower = true

自定义CSS&JS

[params]
  # 这里我存放在了主题的static文件夹里,根目录的似乎也可以
  customCSS = ['douban.css', 'other.css']
  # if ['custom.css'], load '/static/css/custom.css' file
  customJS = ['douban.js']
  # if ['custom.js'], load '/static/js/custom.js' file

添加了部分自定义的shortcode

  • Octopress blockquote (blockquote.html)
  • Wikipedia Link Generator (wp.html)
{{< youku id="_XMzcxODQ2NjM2NA==" autoplay="true" >}}
  • youku(youku.html)

贡献

欢迎大家贡献,不限于代码、Issue,功能特性,想法等等,期待看到你的PR或者ISSUE。

其他平台上的 Maupassant 主题

maupassant-hugo's People

Contributors

caijinglong avatar flysnoworg avatar lartpang avatar jokerqyou avatar guader avatar

Watchers

 avatar  avatar

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.