• Stars
    star
    660
  • Rank 68,297 (Top 2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 7 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Rediscover the beauty of typography.

hexo-theme-Typography

Head

Screenshot

点击这里阅读简体中文版使用文档

Installing

Prerequisite – Ensure the dependencies

Do not simply copy and paste the whole block of codes, please take a carefully look in advance. :)

cd hexo # cd into the root directory of your Hexo blog

Yarn users

yarn remove hexo-generator-category # we'll use hexo-generator-category-enhance instead
yarn add hexo-renderer-pug hexo-generator-archive hexo-generator-category-enhance hexo-generator-feed hexo-generator-tag
yarn add hexo-prism-plugin # for syntax highlighting

Npm users

npm uninstall --save hexo-generator-category # we'll use hexo-generator-category-enhance instead
npm install --save hexo-renderer-pug hexo-generator-archive hexo-generator-category-enhance hexo-generator-feed hexo-generator-tag
npm install --save hexo-prism-plugin # for syntax highlighting

Installing the theme

git clone https://github.com/SumiMakito/hexo-theme-typography themes/typography
cd themes/typography
npm install
yarn install # for yarn users

Modifying the config file

To use Typography, some modifications on the your blog's root-level _config.yml is necessary.

theme: typography

highlight:
  enable: false # we will use the prism plugin instead

plugin:
  - hexo-generator-category-enhance
  - hexo-generator-feed
  - hexo-asset-image
  - hexo-prism-plugin
  - hexo-toc
  # ... other plugins you'd like to enable

# Generate archive page
archive_generator:
  per_page: 0

# Generate categories index page and each category page
category_generator:
  per_page: 10
  enable_index_page: true

# Generate tags index page and each tag page
tag_generator:
  per_page: 10
  enable_index_page: true

# Generator atom feed for you website
feed:
  type: atom
  path: atom.xml
  limit: 20
  hub:
  content:
  content_limit: 140
  content_limit_delim: ' '

# For syntax highlighting
prism_plugin:
  mode: 'preprocess'
  theme: 'default'
  line_number: true 

Updating

cd themes/typography
git pull
npm run build
yarn run build # for yarn users

You may encounter the error modified: themes/typography if you are managing the whole blog with git. In that case, instead of using git push, we recommend you to download the zip and update the theme manually.

Customizing

Typography has packed up several labor-saving functions, thus you can easily make any change at any time in the _config.yml file located in the root directory of the theme.

Correctly define the title* Important *

Typography has three titles: title, title_primary, and title_secondary. The title is defined in the _config.yml inside the Hexo blog's root directory while the title_primary and title_secondary are defined in Typography's _config.yml.

  • title: The <title> of all the HTML pages.
  • title_primary: The bigger title to display on nav/side bar.
  • title_secondary : The smaller title to display on nav/side bar.

Change the language

Modify the .yml files in themes/typography/languages or add new files according to your need.

Auto truncate

It is possible to control the length for all the summaries on the index page by setting a value for truncate_len. The default length is 160.

e.g. truncate_len: 160

Changing the color scheme

You can find this option in theme's _config.yml.

Currently, there are two color schemes available:

  • light
  • dark
themeStyle: light

Set up the comment service

The comment box is a place for readers to exchange their ideas with the author. Typography has integrated two 3rd-party comment services, and they are ready to use at any time.

Currently, Typography supports comment services provided by Disqus and LiveRe. The only thing you need to do is to set the corresponding key for the comment service that you would like to use.

e.g. disqus: disqus_shortname OR livere: livere_data_uid

Do not use two comment services at the same time, or the post will be followed by two comment boxes. Just leave blank for the rest of the comment service-related options.

Show/Hide the page indicator

Set to false to hide the page indicator above the page switcher.

showPageCount: true

Show/Hide categories and tags links behind post title

You can choose whether or not to show categories and tags links behind post title in index and post page by changing the following values in theme's _config.yml:

showCategories: true
showTag: true

Set website favicon

Prepare favicon.png file and put in themes/typography/source/images/favicon.png

Embed Google Analytics in your blog

Find the line below in themes/typography/source/js/google-analytics.js:

ga('create', 'UA-73442912-1', 'auto');

Replace UA-73442912-1 with your own google analytics id.

SEO-friendly meta description tag

Typography gives you the chance to insert unique SEO-friendly meta description tags for different posts. Also, it is handy. Just add a new line in the head section of your post:

title: Another post
date: 1970-01-01 00:00
desc: Description to be inserted into the metadata of the post page.
---

Then the generated HTML file will contain:

<meta name="description" content="Description to be inserted into the metadata of the post page.">

If desc is not specified, the first 140 words of the post will be used as the description.

Icons for social network accounts

Typography natively supports the following social network accounts:

  • Twitter
  • GitHub
  • Instagram
  • Sina Weibo

To use light up those icons, just simply set the values for the corresponding options.

twitter: user_name
weibo: user_id/permanent_name
instagram: user_name
github: user_name

Tips: leave blanks to remove the icons from the site.

Customize2

Please edit scss files instead of css files. We recommend you to run npm run watch (or yarn run watch) to watch changes on scss files. But plesae be noted that npm run watch does not provide auto-prefixing support on compiled css files. Running npm run build (or yarn run build), which has support for CSS compressing and auto-prefixing, after you have done your modifications and before deploying your blog is recommended.

Typography uses node-sass and scss-compile to generate .css files for styling. We have provided several options such as background and foreground colors for you to choose. When your editing is finished, do not forget to run the commands below to re-generate the .css files:

cd themes/typography
npm run build
yarn run build # for yarn users

.scss files are located in theme/typography/raw/scss.

Customize3

As for the pug templates inside theme/typography/layout, just edit them and remember to add some pepper as you like it.

Contributors

Support me

I am a freelance student developer. (with bloody little income)

Please consider buy me a cup of caramel macchiato if you really like my work. _(:з」∠)_

Thank you very much.

WeChat QR code

Alipay QR code

WeChat and Alipay are both accepted.

License

© 2017-2018 Makito

Typography is released under the MIT license.

More Repositories

1

AwesomeQRCode

An awesome QR code generator for Android.
Kotlin
1,886
star
2

Awesome-qr.js

An awesome QR code generator written in JavaScript.
JavaScript
1,668
star
3

hexo-theme-Journal

隻言片語・於此匯聚 – Moments piled up. Live demo →
CSS
305
star
4

AdvancedTextSwitcher

Advanced TextSwitcher for faster development.
Java
245
star
5

QuickKV

Lightweight & Easy-to-use Key-Value Library for Android Projects.
Java
132
star
6

AwesomeQRCode-Kotlin

AwesomeQRCode in Kotlin.
Kotlin
61
star
7

GitPro

Use GitHub Like a Pro
CSS
36
star
8

A-star

A*(A-star) pathfinding algorithm in C++
C++
33
star
9

DroidCurvesView

A custom view for Android inspired by Curves Tool in Photoshop.
Java
27
star
10

RhythmView

Kotlin
26
star
11

NeteaseCloudMusic-Now-Playing

C
24
star
12

ReinaDownloader

Multi-thread & Multi-task downloading library for Android projects.
Java
21
star
13

BiliNyan-Android

一个 Material Design 风格的第三方哔哩哔哩 Android 客户端
Java
12
star
14

Chrome-GitHub-Feed-Moderator

CSS
10
star
15

webpxmux.js

A JavaScript library for muxing and demuxing animated WebP images and encoding and decoding WebP images.
JavaScript
10
star
16

Chrome-qwq

The naughtiest qwq that you have never ever seen before.
JavaScript
7
star
17

Stacktodo

A todo list* powered by React.js, Django and PostgreSQL. (*demo)
JavaScript
4
star
18

MaglevIO

An easy-to-use and efficient Java I/O library. Based on Java NativeIO.
Java
4
star
19

raft

An implementation of the Raft distributed consensus algorithm in Go.
Go
4
star
20

chocola-js

4
star
21

sumimakito

3
star
22

HimitsuQR

加密二维码,让二维码更安全。
Java
3
star
23

Decompiled-Chongcai

#Abandoned
3
star
24

apple-watch-rgb

RGB light for your 🎃 (maybe)
Swift
2
star
25

Naive-Solver-for-Word-Guessing-Games

A general but naïve solver for word guessing games.
Python
2
star
26

hexo-renderer-pejs

PEJS renderer for Hexo
1
star
27

Sandcastle-Quality-Tracker

1
star
28

Apple-Watch-RGB

RGB light for your 🎃 (maybe)
Swift
1
star
29

ffmpeg-dmx4a

Modified version of FFmpeg which is used in DMX4A, the core of Bilisound.
1
star
30

TiebaEmailExtractor

Extract email addresses easily.
Java
1
star
31

BuildMaid-CI-Test-Android

Kotlin
1
star
32

uTickets

TypeScript
1
star
33

EFEFDouga

二匚二匚動画です
HTML
1
star