Skip to content

Commit

Permalink
#189 Update theme documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sylhare committed Sep 21, 2019
1 parent 9684605 commit 769e8bf
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 109 deletions.
216 changes: 127 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,70 +102,40 @@ and as meta properties for search engines, browsers, and the site's RSS feed.
Change these variables in `_config.yml`:

```yml
theme_settings:
title: My Jekyll Blog # Name of website
avatar: assets/img/triangle.png # Path of avatar image, to be displayed in the theme's header
description: My blog posts # Short description, primarily used by search engines
title: My Jekyll Blog # Name of website
avatar: assets/img/triangle.png # Path of avatar image, to be displayed in the theme's header
description: My blog posts # Short description, primarily used by search engines
favicon: assets/favicon.ico # Icon displayed in the tab
```

### Customizing text
### Main configuration

#### Footer and Header's text

Customize your site header/footer with these variables in `_config.yml`:

```yml
theme_settings:
header_text: Welcome to my Jekyll blog
header_feature_image: assets/img/sample3.png
footer_text: Copyright 2017
header_text: Welcome to my Jekyll blog
header_feature_image: assets/img/sample3.png
footer_text: Copyright 2017
```

If you don't want anything, replace the value by `" "`.

#### Localisation string

Change localization string variables in `_config.yml`.
Localization string is a way to quickly change the template language for text like *Next Post* or *Follow on*, ...
You can find all the properties in `_data/language.yml`.

English text used in the theme has been grouped so you can quickly translate the theme or change labels to suit your needs.
By default it is in english, but you can easily add your own language.

```yml
theme_settings:
str_follow_on: "Follow on"
str_rss_follow: "Follow RSS feed"
str_email: "Email"
str_next_post: "Next post"
str_previous_post: "Previous post"
str_next_page: "Next"
str_previous_page: "Prev"
str_continue_reading: "Continue reading"
str_javascript_required_disqus: "Please enable JavaScript to view comments."
```


### Other features

Jekyll works with [liquid](https://shopify.github.io/liquid/) tags usually represented by:

```
{{ liquid.tag | filter }}
```

These are useful to render your jekyll files.
You can learn more about them on [shopify's doc](https://help.shopify.com/themes/liquid/basics)

### Footer's icons
### Google Analytics

Display the site's icon from [Font Awesome](https://fortawesome.github.io/Font-Awesome/) in the footer.
All icon variables should be your username enclosed in quotes (e.g. "username") in `_config.yml`,
except for the following variables:
To enable Google Analytics, add your [tracking ID](https://support.google.com/analytics/answer/1032385)
to `_config.yml` like so:

```yml
theme_settings:
rss: true # Make sure you created a feed.xml with feed.xml layout
email_address: [email protected]
linkedin: https://www.linkedin.com/in/FirstLast
stack_exchange: https://stackoverflow.com/users/0000/first-last
google_analytics: UA-NNNNNNNN-N
```

### Comments (via Disqus)
Expand All @@ -177,27 +147,15 @@ To enable Disqus comments, add your [Disqus shortname](https://help.disqus.com/c
to your project's `_config.yml` file:

```yml
theme_settings:
disqus_shortname: my_disqus_shortname
```

### Google Analytics

To enable Google Analytics, add your [tracking ID](https://support.google.com/analytics/answer/1032385)
to `_config.yml` like so:

```yml
theme_settings:
google_analytics: UA-NNNNNNNN-N
disqus_shortname: my_disqus_shortname
```

### Math typesetting

When KateX is set in `_config.yml`:

```yml
theme_settings:
katex: true # to Enable it
katex: true # to Enable it
```

You can then wrap math expressions with `$$` signs in your posts and make sure you have set the `katex` variable
Expand All @@ -217,30 +175,38 @@ $$
$$
```

### Post excerpt
### Social icons

The [excerpt](https://jekyllrb.com/docs/posts/#post-excerpts) are the first lines of an article that is display on the blog page.
The length of the excerpt has a default of around `250` characters and can be manually set in the post using:
In `_data/social.yml` you can customize the social icons from other wbesite you wish to display in the blog.
The site icons come from [Font Awesome](https://fortawesome.github.io/Font-Awesome/).

```yml
---
layout: post
title: Sample Page
excerpt_separator: <!--more-->
---
#### Share in article

some text in the excerpt
<!--more-->
... rest of the text not shown in the excerpt ...
The share icons are the one at the bottom of the blog page if enabled,
to share the article on those platform.


#### Footer

Display in the footer.
All icon variables should be your username enclosed in quotes (e.g. "username") in `_config.yml`,
except for the following variables:

```yml
rss: true # Make sure you created a feed.xml with feed.xml layout
email_address: [email protected]
linkedin: https://www.linkedin.com/in/FirstLast
stack_exchange: https://stackexchangecom/users/0000/first-last
stack_overflow: https://stackoverflow.com/users/0000/first-last
```

The html is stripped out of the excerpt so it only display text.
### Customizing Posts

## Layout
Please refer to the [Jekyll docs for writing posts](https://jekyllrb.com/docs/posts/).
Non-standard features are documented below.
When writing a post, be sure in jekyll to:
- Put it in the `_posts` folder
- Name it with the date first like `2019-08-21-This-is-my-blog-post.md`

### Layout: Post
#### Layout: Post

This are the basic features you can use with the `post` layout.

Expand All @@ -258,14 +224,37 @@ tags: [sample, markdown, html]
```

With `thumbnail`, you can add a smaller image than the `feature-img`.
If you don't want/have a thumbnail you can still use the same image as the feature one.
If you don't have a thumbnail you can still use the same image as the feature one.

The background used when `color` is set comes from `lineart.png` from [xukimseven](https://github.com/xukimseven)
you can edit it in the config file (`theme_settings > color_image`). If you want another one, put it in `/assets/img` as well.
you can edit it in the config file (`_config.yml > color_image`). If you want another one, put it in `/assets/img` as well.

The **bootstrap** is not mandatory and is only useful if you want to add bootstrapped content in your page.
It will respect the page and theme layout, mind the padding on the sides.

#### Post excerpt

The [excerpt](https://jekyllrb.com/docs/posts/#post-excerpts) are the first lines of an article that is display on the blog page.
The length of the excerpt has a default of around `250` characters and can be manually set in the post using:

```yml
---
layout: post
title: Sample Page
excerpt_separator: <!--more-->
---

some text in the excerpt
<!--more-->
... rest of the text not shown in the excerpt ...
```

The html is stripped out of the excerpt so it only display text.

## Other Layouts
Please refer to the [Jekyll docs for writing posts](https://jekyllrb.com/docs/posts/).
Non-standard features are documented below.

### Layout: Page

The page layout have a bit more features explained here.
Expand Down Expand Up @@ -335,6 +324,21 @@ date: 2019-07-25 # Not mandatory, however needs to be in date format t
---
```

#### Portfolio in gem

Make sure your `_config.yml` contains the following if you are using the theme as a gem:

```yml

# PORTFOLIO
collections:
portfolio:
output: true
permalink: /:collection/:name
```

This creates the collection for Jekyll so it can find and display your portfolio posts.

### Gallery

You can create a gallery using [Masonry JS](https://masonry.desandro.com/) which will placing the pictures in optimal position
Expand Down Expand Up @@ -390,21 +394,18 @@ tags: [sample, markdown, html]
All the tags will be listed in `tags.html` with a link toward the pages or posts.
The Tag page can be hidden with the `hide` option. You can remove the icon by removing `icon` (like for the search page).

## Template as a Gem
## Advanced

You can use Type-on-strap as a [gem](https://rubygems.org/gems/type-on-strap).
Checkout an example in the [gem-demo branch](https://github.com/Sylhare/Type-on-Strap/tree/gem-demo).
To make the feature pages available in from the gem I created them as layouts that can be invoked in the pages folder.
### Liquid tags

So if you're using the template as a theme, Make sure you have:
- A `index.html` file
- The right `_config.yml` with the theme setting such as `theme: type-on-strap` uncommented
- The feature page included. (ex: as it is already in `pages`)
- Some content ready in `_posts` and `_portfolio` to be displayed
Jekyll works with [liquid](https://shopify.github.io/liquid/) tags usually represented by:

Now you can use any theme gem with github pages : [29/11/2017 Github Pages Broadcast](https://github.com/blog/2464-use-any-theme-with-github-pages)
```
{{ liquid.tag | filter }}
```

## Advanced
These are useful to render your jekyll files.
You can learn more about them on [shopify's doc](https://help.shopify.com/themes/liquid/basics)

### Minimizing and optimizing: css, js and images

Expand All @@ -428,6 +429,43 @@ gulp default
git status
```

### Use as Ruby Gem

You can use Type-on-strap as a [gem](https://rubygems.org/gems/type-on-strap).

Ruby Gem Method
Add this line to your Jekyll site's Gemfile (or create one):

```ruby
gem "type-on-strap"
```
Add this line to your Jekyll site's `_config.yml` file:

```yml
theme: jekyll-theme-so-simple
```

Then run Bundler to install the theme gem and dependencies:

```bash
bundle install
```

Then you can start adding content like:
- Add a `index.html` file
- Add the feature page you want. (ex: as it is already in `pages`)
- Add posts in `_posts` and `_portfolio` to be displayed


### Remote Theme

Now you can use any theme gem with github pages with [29/11/2017 Github Pages Broadcast](https://github.com/blog/2464-use-any-theme-with-github-pages).
For that remove all `theme:` attributes from `_config.yml` and add instead:

```yml
remote_theme: sylhare/Type-on-Strap
```

## License

There are some fonts and component on this theme going under the MIT licence as well in this theme.
Expand Down
35 changes: 17 additions & 18 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
# SITE CONFIGURATION
baseurl: "/Type-on-Strap"
url: "https://sylhare.github.io"
title: Type on Strap # site's title
description: "A website with blog posts and pages" # used by search engines

# THEME-SPECIFIC CONFIGURATION
# Images
avatar: assets/img/triangle.png # Empty for no avatar in navbar
color_image: /assets/img/lineart.png # A bit transparent for color posts.
favicon: assets/favicon.ico # Icon displayed in the tab
title: Type on Strap # site's title
description: "A website with blog posts and pages" # used by search engines
avatar: assets/img/triangle.png # Empty for no avatar in navbar
favicon: assets/favicon.ico # Icon displayed in the tab

# Header and footer text
header_text: # Change Blog header text
header_text: # Change Blog header text
header_feature_image: assets/img/pexels/triangular.jpeg
footer_text: >
Powered by <a href="https://jekyllrb.com/">Jekyll</a> with <a href="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/sylhare/Type-on-Strap">Type on Strap</a>
# Blog
excerpt: true # Or "truncate" (first 250 characters), "false" to disable
excerpt: true # Or "truncate" (first 250 characters), "false" to disable
post_navigation: true
color_image: /assets/img/lineart.png # A bit transparent for color posts.

# Features
footer_icons: # In _data/social.yml
share_buttons: # In _data/social.yml
authors: # In _data/authors.yml
language: # In _data/language.yml
google_analytics: # Tracking ID, e.g. "UA-000000-01"
disqus_shortname: # Your discus shortname for comments
katex: true # Enable if using math markup
layout_variables: # Open the "_sass > base" folder, and open "_variables.scss"
katex: true # Enable if using math markup
google_analytics: # Tracking ID, e.g. "UA-000000-01"
disqus_shortname: # Your discus shortname for comments
layout_variables: # Open the "_sass > base" folder, and open "_variables.scss"
footer_icons: # In _data/social.yml
share_buttons: # In _data/social.yml
authors: # In _data/authors.yml
language: # In _data/language.yml

# PAGINATION
paginate: 5
Expand All @@ -50,5 +49,5 @@ plugins: [jekyll-paginate, jekyll-seo-tag, jekyll-feed]
exclude: [".jekyll-cache", "Gemfile", "Gemfile.lock", "type-on-strap.gemspec", "*.gem", ".idea", "vendor/*",
"LICENSE", "README.md", "screenshot.png", "assets/package.json", "assets/node_modules", "assets/gulpfile.js"]

# theme: type-on-strap # Uncomment if using the theme as a jekyll theme gem
remote_theme: sylhare/Type-on-Strap # If using as a remote_theme in github
# theme: type-on-strap # if using the theme as a jekyll theme gem
remote_theme: sylhare/Type-on-Strap # If using as a remote_theme in github
6 changes: 4 additions & 2 deletions type-on-strap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ Gem::Specification.new do |spec|
spec.homepage = "https://github.com/sylhare/Type-on-Strap"
spec.license = "MIT"

spec.rdoc_options = ["--charset=UTF-8"]
spec.extra_rdoc_files = %w(README.md LICENSE)
spec.metadata["plugin_type"] = "theme"
spec.files = `git ls-files -z`.split("\x0").select do |f|
spec.files = `git ls-files -z`.split("\x0").select do |f|
f.match(%r!^(assets/(js|css|fonts|data)/|_(includes|layouts|sass)/|_data/language.yml|(LICENSE|README)((\.(txt|md|markdown)|$)))!i)
end

spec.required_ruby_version = '>= 2.4'
spec.required_ruby_version = '>= 2.4'

spec.add_runtime_dependency "jekyll", ">= 3.5", "< 5.0"
spec.add_runtime_dependency "jekyll-feed", "~> 0.9"
Expand Down

0 comments on commit 769e8bf

Please sign in to comment.