Coder Social home page Coder Social logo

mogege's Introduction

mogege

Hugo License: MIT

A blog theme for Hugo.

Screenshot

This project is based on LeaveIt

Because the author of LeaveIt seems to have abandoned this project, but I prefer this theme, so I simply reopened a new project.

At this stage, I mainly integrate the part I modified with LeaveIt, and will add more features in the future.

Features

  • Images lazy loading (Can I use?)
  • Automatically highlighting code (Support by highlight.js)
  • TeX Functions (Support by KaTeX)
  • PlantUML (Sequence diagram, Usecase diagram, Class diagram ...)
  • Dark/Light Mode
  • Support for embedded BiliBili video
  • Support hidden text ...

Here is a table showing the similarities and differences between mogege and LeaveIt:

Features mogege LeaveIt
Categories Yes Yes
Tags Yes Yes
RSS support Yes Yes
sitemap.xml Yes Yes
robots.txt Yes Yes
Quote Optimization Yes
Images lazy loading Optimization* Yes
Dark/Light Mode Optimization Yes
Highlighting code Optimization Yes
Comment area Optimization Yes
TeX Functions Yes
PlantUML Yes
BiliBili video (shortcodes) Yes
Hidden text (shortcodes) Yes
Social button Yes Yes
lightGallery Yes

Requirements

Hugo 0.68.3 or higher

Hugo extended version, read more here

Installation

Navigate to your hugo project root and run:

git submodule add https://github.com/Mogeko/mogege themes/mogege

Then run hugo (or set theme: mogege in configuration file)

hugo server --minify --theme mogege

Creating site from scratch

Below is example how to create new site from scratch

hugo new site mydocs; cd mydocs
git init
git submodule add https://github.com/Mogeko/mogege  themes/mogege
cp -R themes/mogege/exampleSite/content .
hugo server --minify --theme mogege

Lazy loading

If your browser is supported, we will lazy loading <img> and <iframes>

Make sure your browser version:

  • Chrome > 76
  • Firefox > 75

TeX Functions

Note: list of TeX functions supported by KaTeX

To enable KaTex globally set the parameter math to true in a project's config.toml

To enable KaTex on a per page basis include the parameter math: true in content files.

Example

% Inline math:
$$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887$$

% or
% Block math:
$$
 \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
$$

KaTeX

PlantUML

PlantUML is supported by the official server

To enable KaTex globally set the parameter plantuml to true in a project's config.toml

To enable KaTex on a per page basis include the parameter plantuml: true in content files.

You can insert PlantUML in the post by:

```plantuml
PlantUML syntax
```

For example:

@startuml
Bob -> Alice : hello

create Other
Alice -> Other : new

create control String
Alice -> String
note right : You can also put notes!

Alice --> Bob : ok

@enduml

PlantUML

Embedded BiliBili video

You can embed BiliBili videos via Shortcodes, just provide the AV 号/BV 号 of the bilibili video

You can also use the PV 号 to control the 分 P (default: 1)

{{< bilibili [AV号/BV号] [PV号] >}}

Click here for examples

Hidden text

You can use "hidden text" to hide spoiler content

{{< spoiler >}} HIDDEN TEXT {{< /spoiler >}}

Click here for examples

utteranc comment system

This blog supports the utteranc comment system.

It is lighter and more powerful than Gitalk.

To use utteranc, you need make sure the utterances app is installed on the repo, otherwise users will not be able to post comments.

Then enable utteranc in config.toml

[params]
    enableUtteranc = true

Then Configuration: (For more settings, please refer to HomePage)

[params.utteranc] # Homepage: https://utteranc.es
    repo = "" # The repo to store comments
    issueTerm = "title" # the mapping between blog posts and GitHub issues. 
    theme = "preferred-color-scheme" # Theme
    crossorigin = "anonymous" # default: anonymous

Gitalk comment system

This blog supports the gitalk comment system. To use gitalk, you need to apply for a Github Application. For details, please refer to here.

Then enable gitalk in config.toml

[params]
    enableGitalk = true

Then provide your Client ID and Client Secret from Github Application in config.toml

[params.gitalk] # Github: https://github.com/gitalk/gitalk
    clientID = "[Client ID]" # Your client ID
    clientSecret = "[Client Secret]" # Your client secret
    repo = "" # The repo to store comments
    owner = "" # Your GitHub ID
    admin= "" # Required. Github repository owner and collaborators. (Users who having write access to this repository)
    id= "location.pathname" # The unique id of the page.
    labels= "gitalk" # Github issue labels. If you used to use Gitment, you can change it
    perPage= 15 # Pagination size, with maximum 100.
    pagerDirection= "last" # Comment sorting direction, available values are 'last' and 'first'.
    createIssueManually= true # If it is 'false', it is auto to make a Github issue when the administrators login.
    distractionFreeMode= false # Enable hot key (cmd|ctrl + enter) submit comment.

Custom CSS/JavaScript

Support custom CSS or JavaScript

Place your custom CSS and JavaScript files in the /static/css and /static/js directories of your blog, respectively

static
├── css
│   └── _custom.css
└── js
    └── _custom.js

Then edit in config.toml:

[params.custom]
    css = ["css/_custom.css"]
    js = ["js/_custom.js"]

Currently only supports CSS does not support Sass

Configuration

There are few configuration options you can add to your config.toml file.

baseURL = "" # <head> 里面的 baseurl 信息,填你的博客地址
title = "" # 浏览器的标题
languageCode = "zh-cn" # 语言
hasCJKLanguage = true # 开启可以让「字数统计」统计汉字
theme = "mogege" # 主题

paginate = 11 # 每页的文章数
enableEmoji = true # 支持 Emoji
enableRobotsTXT = true # 支持 robots.txt


preserveTaxonomyNames = true

[blackfriday]
  hrefTargetBlank = true
  nofollowLinks = true
  noreferrerLinks = true

[Permalinks]
  posts = "/:year/:filename/"

[menu]
  [[menu.main]]
    name = "Blog"
    url = "/post/"
    weight = 1

  [[menu.main]]
    name = "Categories"
    url = "/categories/"
    weight = 2

  [[menu.main]]
    name = "Tags"
    url = "/tags/"
    weight = 3

  [[menu.main]]
    name = "About"
    url = "/about/"
    weight = 4

[params]
    since =
    author = ""                         # Author's name
    avatar = "/images/me/avatar.jpg"    # Author's avatar
    subtitle = ""                       # Subtitle
    home_mode = ""                      # post or other
    enableGitalk = true                 # gitalk 评论系统

    google_verification = ""

    description = "" # (Meta) 描述
    keywords = "" # site keywords

    beian = ""
    baiduAnalytics = ""
    googleAnalytics = "" # Google 统计 id

    license= '本文采用<a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/" target="_blank">知识共享署名-非商业性使用 4.0 国际许可协议</a>进行许可'

[params.gitalk] # Github: https://github.com/gitalk/gitalk
    clientID = "" # Your client ID
    clientSecret = "" # Your client secret
    repo = "" # The repo to store comments
    owner = "" # Your GitHub ID
    admin= "" # Required. Github repository owner and collaborators. (Users who having write access to this repository)
    id= "location.pathname" # The unique id of the page.
    labels= "gitalk" # Github issue labels. If you used to use Gitment, you can change it
    perPage= 15 # Pagination size, with maximum 100.
    pagerDirection= "last" # Comment sorting direction, available values are 'last' and 'first'.
    createIssueManually= true # If it is 'false', it is auto to make a Github issue when the administrators login.
    distractionFreeMode= false # Enable hot key (cmd|ctrl + enter) submit comment.

The name of this project comes from the game Mogeko Castle, and the author's name also comes from this game. (this is another story)

mogege's People

Contributors

dongm2ez avatar imgbotapp avatar mogeko avatar restyled-commits 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

Watchers

 avatar  avatar  avatar  avatar

mogege's Issues

想请教一下备案设置相关信息

博主您好,我之前就一直使用您的theme感觉非常好用。但是我最近备案审批下来了,只在config.toml中看到有可以插入备案的相关信息描述,而且链接的url还是老的已经停用的备案网站。按照公安部的备案信息相关规定的话,备案号必须链接该备案号的相关链接,所以想请问一下这个beian的变量链接的地址是在哪里可以修改?还有就是备案号前面需要添加相应的备案图标,想请问下如何添加?希望博主能够予以解答,谢谢博主!

支持 Lazy loading

<img><iframes> 添加 Lazy loading 的支持

需要你的浏览器:

  • Chrome > 76
  • Firefox > 75
  • ......

Screenshot_2020-04-13 Can I use Support tables for HTML5, CSS3, etc

开启 uglyURLs=true 后,标签链接的地址仍然是目录形式

你好,mogege主题感觉很棒,最近准备从vuepress切换到hugo,正在测试它。

由于要兼容旧链接,我使用了 uglyURLs 模式,测试的是你的博客 Mogeko/Blog,经测试,Tags页面(/tags.html )下的tag链接地址是 /tags/<TAG>/,但此时应该是 /tags/<TAG>.html,Categories是适配的。

我 Fork 了一份,参照其他主题做了兼容,考虑是否兼容,commit id

原LeaveIt的社交按钮功能

你好,请问原 LeaveIt 的社交按钮(首页的微博、GitHub 链接)功能是移除了吗?在配置文件里配置[params.social]无法显示效果。谢谢~
ps:建议建立 list 清单来说明移除或者添加了哪些功能。

Bilibili Shortcodes 支持 BV号和 PV号(分P)

现在可以在 Bilibili Shortcodes 中使用 BV号 和 PV号(分P) 了

会自动判断你使用的是 AV号 还是 BV号AV号 不需要av/AV 开头,BV号 必须bv/BV 开头
PV号 写在 AV/BV号 后面,仅数字,不需要pv/PV 开头 (1 表示 pv12 表示 pv2,默认为 1)

{{< bilibili [AV号/BV号] [PV号] >}}

more details

为什么不支持行内公式

只有行间公式可以显示,对于行内公式没有渲染,对于如下的代码,不会渲染,直接以字符串显示,$\frac{2}{3}$
请问有什么解决办法吗

暗黑模式切换

想请教一下博主,mogege主题中的暗黑模式的切换按钮没有起作用,是哪里需要设置吗?

用户自定义 CSS 和 JavaScript

允许用户不需要修改 Theme 文件也可以自定义 CSS 和 JavaScript

用户将 CSS 和 JavaScript 分别放入 /static/css/static/js

static
├── css
│   └── _custom.css
└── js
    └── _custom.js

然后修改 config.toml 文件:

[params.custom]
    css = ["css/_custom.css"]
    js = ["js/_custom.js"]

重新设计部分元素

准备重新设计部分元素,使得博客更加的美观大方

TODO list:

  • 重新设计博客的 LOGO 样式
  • 重新设计移动端菜单

支持 PlantUML

支持在文章中直接插入 PlantUML

使用语法:

```pantmul  
PlantUML syntax  
```

PlantUML 将会被实时转换为 SVG

例如:

@startuml
Bob -> Alice : hello

create Other
Alice -> Other : new

create control String
Alice -> String
note right : You can also put notes!

Alice --> Bob : ok

@enduml

PlantUML

移动端功能适配

移动端以下功能暂未适配或者有 Bug:

  • 菜单栏
  • 主题切换 (dark/light)
  • Posts 列表的宽度

半角标点自动转换

2020-05-18_20-43

如图 (请点原图), 文本的半角标点

  • 前面是中文时, 自动转换成全角标点 (红色)
  • 前面是英文时不处理 (绿色)
  • 疑似 bug (黄色)

可以选择停用这个功能吗? (使用 leaveit 主题时默认不转换全 / 半角)

seems like analytic feature not functioning well

background: I find google analytic results is not as expected after switching to mogege.

I checked source code of leaveIt, there is a block for inserting baiduAnalytic in partials/js.html, like below:
Screen Shot 2021-01-01 at 4 04 32 PM

but I can't find any thing related to analytic in source code of mogege.

I am a backend developer, not familiar with frontend stuff. Am I missing something?

请问暗黑模式是怎么修复的呢?

原 Leaveit 切换暗黑模式的时候,当切换为黑色主题时,访问每个页面都会闪现一会儿白色,再变成黑色背景,mogege已经修复了这块,作者是怎么优化这块的呢

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.