Morph
Morph is a simple Jekyll theme for writers.
Installation
Install with github page:
GitHub Pages
- Add these 2 lines in to your
Gemfile
:
gem "jekyll-remote-theme"
gem "jekyll-paginate"
- Install the newly added gems:
$ bundle
- In
_config.yml
add these lines:
remote_theme: alex-1900/jekyll-theme-morph
permalink: /:year/:month/:day/:title.markdown
paginate: 5
plugins:
- jekyll-paginate
- jekyll-remote-theme
Remove any other theme:
or remote_theme:
lines.
- Rename
index.md
toindex.html
. Without this, thejekyll-paginate
gem will not work.
Layouts
Pinned articles
Add the sticky
and sticky_subtitle
(optional) field to post file, and you can find the article at pinned area.
---
sticky: true
sticky_subtitle: some words
---
Add tags and categories page
- create new pages
tags.html
andcategories.html
and add these lines to heads:
---
layout: classify
source: tags
---
---
layout: classify
source: categories
---
- add these lines to your
_config.yml
:
morph:
navigation:
- name: tags
path: /tags
- name: categories
path: /categories
and can see the tags
and categories
buttons now.
Enable tags and categories sidebar
add these lines to your _config.yml
in morph
field:
morph:
include:
home_categories_bar:
title: Top Categories
path: /categories
home_tags_bar:
title: Top Tags
path: /tags
certainly, you can change the titles
and paths
Add searching page
- create
search.json
at project root, and add these lines:
---
layout: none
permalink: /search.json
---
[
{% for post in site.posts %}
{
"title" : {{ post.title | escape | jsonify }},
"category" : {{ post.category | jsonify }},
"tags" : "{{ post.tags | join: ', ' }}",
"url" : "{{ site.baseurl }}{{ post.url }}",
"date" : "{{ post.date }}",
"content" : {{ post.content | strip_html | strip_newlines | remove_chars | jsonify }}
} {% unless forloop.last %},{% endunless %}
{% endfor %}
]
- create a new file
search.html
, and add these lines to head:
---
layout: search
---
- add change your
_config.yml
add a new page tomorph.navigation
:
morph:
navigation:
- name: search
path: /search
custom the article excerpt length in home page
morph:
excerpt_length: 150 # default is 200
custom css and javascript files
Add front matters in your pages
scripts: [
/assets/your-custom-script1.js,
/assets/your-custom-script2.js
]
styles: [
/assets/your-custom-stylesheet1.css,
/assets/your-custom-stylesheet2.css
]
Change the skin
There are two skins: silver
(default) and obsidian
, you can switching between multiple skins by _config.yml
:
morph:
skin: obsidian
and rebuild or restart the dev server
Custom skin
create file _sass/skink/skin_name.scss
, and enable in _config.yml
:
# _config.yml
sass:
sass_dir: _sass
style: compressed
morph:
skin: skin_name
and rebuild or restart the dev server
Multiple language
-
Create directory and file
__data/language/[lang].yml
(the[lang]
is abbreviation of your language) -
replace contents with another language, the following are the default values.
t:
posts: posts
tags_low: tags
tags_up: Tags
categories_low: categories
categories_up: Categories
about_low: about
about_up: About
search_low: search
search_up: Search
catalogue: Catalogue
home: Home
page: Page
post_up: Post
search_placeholder: input key words here...
update_time: Update time
pinned_articles: Pinned Articles
top_tags: Top Tags
top_categories: Top Categories
show_more: show more
catalogue_empty: Catalogue is empty
previous_page: Previous
next_page: Next
3 add your the lang
item to your page files
---
lang: [lang]
---
(the [lang]
is abbreviation of your language)
- for posts page, you can change the defaults scope:
defaults:
- scope:
type: "posts"
values:
lang: [lang] # the `[lang]` is abbreviation of your language
and rebuild or restart the dev server