General notes and suggestions for customizing Neo-HPSTR.
Basic Setup for a new Jekyll site
- Install Bundler
and then install Jekyll and all dependencies1
gem install bundler
.1
bundle install
- Fork the Neo-HPSTR Jekyll Theme repo.
- Clone the repo you just forked and rename it.
- Edit
to personalize your site.1
_config.yml
- Check out the sample posts in
to see examples for pulling in large feature images, assigning categories and tags, and other YAML data.1
_posts
- Read the documentation below for further customization pointers and documentation.
Pro-tip: Delete the
branch after cloning and start fresh by branching off 1
gh-pages
. There is a bunch of garbage in 1
master
used for the theme’s demo site that I’m guessing you don’t want on your site.1
gh-pages
Setup for an Existing Jekyll site
- Clone the following folders:
,1
_includes
,1
_layouts
,1
_sass
, and1
assets
.1
images
- Clone the following folders/files and personalize content as need:
,1
posts/
,1
tags/
and1
feed.xml
.1
index.html
- Set the following variables in your
file:1
config.yml
title: Blog Title
description: Describe your website here.
disqus_shortname: neohpstrtheme # put your disqus here
reading_time: true # if true, shows the estimated reading time for a post
words_per_minute: 200
logo: images/logo.png # logo visible in the topbar
# Your site's domain goes here (eg: //mmistakes.github.io, http://mademistakes.com, etc)
# When testing locally leave blank or use http://localhost:4000
# url: http://aronbordin.com/neo-hpstr-jekyll-theme
# draw your top menu here
# each item must have a title and a url.
# To list post categories. use type: 'categories'
# To create sub categories. add a submenu item
# See the example
menu:
- title: 'Home'
url: '/'
- title: 'Fork'
url: 'http://github.com/aron-bordin/neo-hpstr-jekyll-theme'
- title: 'Install'
url: '/theme-setup/'
- title: 'Tags'
url: '/tags'
- title: 'Categories'
url: '/categories'
type: 'categories'
- title: 'Favorites'
url: '#'
submenu:
- title: 'highlighter'
url: '/code-highlighting-post/'
- title: 'intro'
url: '/readability-post/'
# Owner/author information
owner:
name: Your name
site: http://aronbordin.com
avatar: images/avatar.jpg
bio: "Your bio goes here. It shouldn't be super long but a good two sentences or two should suffice."
email: you@email.com
# Twitter nick for use in Twitter cards and follow button.
twitter: aron_bordin # if no twitter in this config, the twitter follow button will be removed
# GitHub nick for use in follow button in author block.
github: aron-bordin
# Twitter account associated with the site if different from owner/author twitter account.
# Used in Twitter cards.
twitter:
# Social networking links used in author block underneath posts. Update and remove as you like.
social:
- title: "github"
url: "https://github.com/aron-bordin"
- title: "linkedin"
url: "https://br.linkedin.com/in/aronbordin"
- title: "youtube"
url: "https://www.youtube.com/channel/UCfnSek-9HPWOx5e2pH7VFgg"
# Background image to be tiled on all pages
background:
# Analytics and webmaster tools stuff goes here
google_analytics:
google_verify:
# https://ssl.bing.com/webmaster/configure/verify/ownership Option 2 content= goes here
bing_verify:
# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
timezone: America/New_York
locale: en_US
future: true
highlighter: pygments
markdown: kramdown
gems:
- jekyll-sitemap
sass:
sass_dir: _sass
style: compressed
# https://github.com/mojombo/jekyll/wiki/Permalinks
permalink: /:categories/:title/
# Amount of post to show on home page
paginate: 5
# if true, shows the floatting share buttons
float_share: true
kramdown:
auto_ids: true
footnote_nr: 1
entity_output: as_char
toc_levels: 1..6
use_coderay: true
coderay:
coderay_line_numbers: nil
coderay_line_numbers_start: 1
coderay_tab_width: 4
coderay_bold_every: 10
coderay_css: class
include: [".htaccess"]
exclude: ["lib", "config.rb", "Capfile", "config", "Gemfile", "Gemfile.lock", "README.md", "LICENSE", "log", "Rakefile", "Rakefile.rb", "tmp", "less", "*.sublime-project", "*.sublime-workspace", "test", "spec", "Gruntfile.js", "package.json", "node_modules"]
Running Jekyll
If
and 1
jekyll build
throw errors you may have to run Jekyll with 1
jekyll serve
instead.1
bundle exec
In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle.
However, this is unreliable and is the source of considerable pain. Even if it looks like it works, it may not work in the future or on another machine.
bundle exec jekyll build
bundle exec jekyll serve
Folder Structure
hpstr-jekyll-theme/
├── _includes
| ├── author.html # Author panel
| ├── browser-upgrade.html # prompt to upgrade browser on < IE8
| ├── disqus_comments.html # disqus comment panel
| ├── footer.html # site footer
| ├── head.html # site head
| ├── navigation.html # site navigation
| └── scripts.html # jQuery, plugins, GA, etc
├── _layouts
| ├── page.html # page layout
| ├── post-index.html # post layout used on home page
| └── post.html # post layout used on reading
├── _posts
├── _sass # Sass partials
├── assets
| ├── css # compiled stylesheets
| ├── js
| | ├── _main.js # plugin options
| | ├── scripts.min.js # concatenated and minifed site scripts
| | ├── plugins # plugin scripts
| └── └── vendor # jQuery and Modernizr scripts
├── images # images for posts and pages
├── _config.yml # Jekyll options
├── posts/ # all posts
├── tags/ # all posts grouped by tag
└── index.html # home page with pagination
Customization
Most of the variables found here are used in the .html files found in
if you need to add or remove anything. A good place to start would be to add the 1
_includes
, 1
title
, and 1
description
for your site. Links are absolute and prefixed with 1
url
in the various 1
{{ site.url }}
and 1
_includes
, so remember to properly set 1
_layouts
1 to 1
url
when developing locally.1
http://localhost:4000
Disqus Comments
Create a Disqus account and change
in 1
disqus_shortname
to the Disqus shortname you just setup. By default comments appear on all post and pages if you assigned a shortname. To disable commenting on a post or page, add the following to its YAML Front Matter:1
_config.yml
comments: false
Social Share Links
To disable Facebook, Twitter, and Google+ share links on a post or page, add the following to its front matter:
share: false
Floating Social Share Links
To enable floating share links on the left of the screen, edit it on
:1
_config.yml
float_share: true
Owner/Author Information
Change your name, and avatar photo (200x200 pixels or larger), email, and social networking URLs. If you want to link to an external image on Gravatar or something similar you’ll need to edit the path in
since it assumes it is hosted on your site.1
_includes/author.html
Google Analytics and Webmaster Tools
Your Google Analytics ID goes here along with meta tags for Google Webmaster Tools and Bing Webmaster Tools site verification.
Top Menu - Navigation Links
To add additional links in the menu edit
. Use the following format to set the URL and title for as many links as you’d like. External links will open in a new window.. You can create a sub-category using the 1
_config.yml
item. Also, you can list your post categories setting the 1
submenu
1
type: 'categories'
menu:
- title: 'Home'
url: '/'
- title: 'Fork'
url: 'http://github.com/aron-bordin/neo-hpstr-jekyll-theme'
- title: 'Install'
url: '/theme-setup/'
- title: 'Tags'
url: '/tags'
- title: 'Categories'
url: '/categories'
type: 'categories'
- title: 'Favorites'
url: '#'
submenu:
- title: 'highlighter'
url: '/code-highlighting-post/'
- title: 'intro'
url: '/readability-post/'
Adding New Content with Octopress
While completely optional, I’ve included Octopress and some starter templates to automate the creation of new posts and pages. To take advantage of it start by installing the Octopress gem if it isn’t already.
$ gem install octopress
New Post
Default command
$ octopress new post "Post Title"
Default works great if you want all your posts in one directory, but if you’re like me and want to group them into subfolders like
, 1
/posts
, etc. Then this is the command for you. By specifying the DIR it will create a new post in that folder and populate the 1
/portfolio
YAML with the same value.1
categories:
$ octopress new post "New Portfolio Post Title" --dir portfolio
New Page
To create a new page use the following command.
$ octopress new page new-page/
Jekyll _includes
For the most part you can leave these as is since the author/owner details are pulled from
. That said you’ll probably want to customize the copyright stuff in 1
_config.yml
to your liking.1
footer.html
Reading Time
On by default. To turn off remove
from 1
reading_time
. Default words per minute is set at 200 and can changed by updating 1
_config.yml
in 1
words_per_minute
.1
_config.yml
Post/Page Thumbnails for OG and Twitter Cards
Post and page thumbnails work the same way. These are used by Open Graph and Twitter Cards meta tags found in
. If you don’t assign a thumbnail the image you assigned to 1
head.html
in 1
site.owner.avatar
will be used.1
_config.yml
Here’s an example of what a tweet to your site could look like if you activate Twitter Cards and include all the metas in your post’s YAML.
Videos
Video embeds are responsive and scale with the width of the main content block with the help of FitVids.
Adding YouTube video embeds causes errors when building your Jekyll site. To fix wrap the html within
tags. Example below:1
{::nomarkdown}
{::nomarkdown}
<iframe width="560" height="315" src="http://www.youtube.com/embed/PWf4WUoMXwg" frameborder="0" allowfullscreen></iframe>
{:/nomarkdown}
Twitter Cards
Twitter cards make it possible to attach images and post summaries to Tweets that link to your content. Summary Card meta tags have been added to
to support this, you just need to validate and apply your domain to turn it on.1
head.html
Link Post Type
Link blog like a champ by adding
to a post’s YAML front matter. Arrow glyph links to the post’s permalink and the the 1
link: http://url-you-want-linked
links to the source URL. Here’s an example of a link post if you need a visual.1
post-title
Style Customization
Here you’ll find some useful scss variables to help you to customize your Blog interface. All variables can be found at
.1
_sass/_variables.scss
Top Navbar Size
To change its size, edit the
value. It’s recommended a value between 50px and 100px. This variable will automatically update the icon and menu size for you.1
$menu-height
Top Navbar Colors
The navbar uses two colors, the top color and overflow color. The top color represents the navbar color when the window is not scrolled and the overflow color represents the color when we have a sufficient scroll to change its color.
You can change these colors using the
and 1
$menu-top
variable values.1
$menu-overflow
Top Navbar hover color
The color that you see in the item under the mouse can be changed in the
variable.1
$header-margin
Further Customization
Jekyll 2.x added support for Sass files making it much easier to modify a theme’s fonts and colors. By editing values found in
you can fine tune the site’s colors and typography.1
_sass/variables.scss
For example if you wanted a red background instead of white you’d change
to 1
$bodycolor: #fff;
.1
$bodycolor: $cc0033;
To modify the site’s JavaScript files I setup a Grunt build script to lint/concatenate/minify all scripts into
. Install Node.js, then install Grunt, and then finally install the dependencies for the theme contained in 1
scripts.min.js
:1
package.json
npm install
From the theme’s root, use
to concatenate JavaScript files and optimize 1
grunt
, 1
.jpg
and 1
.png
files in the 1
.svg
folder.1
images/
You can also use
in combination with 1
grunt dev
to watch for updates in JS files that Grunt will then automatically re-build as you write your code, which will in turn auto-generate your Jekyll site when developing locally.1
bundle exec jekyll serve
Questions?
Having a problem getting something to work or want to know why I setup something in a certain way? File a GitHub Issue. And if you make something cool with this theme feel free to let me know.
License
This theme is free and open source software, distributed under the MIT License version 2 or later. So feel free to to modify this theme to suit your needs.
-
Used to generate absolute URLs in
, and for canonical URLs in1
feed.xml
. Don’t include a trailing1
head.html
in your base url ie: http://mademistakes.com. When developing locally I suggest using http://localhost:4000 or whatever localhost you’re using to properly load all theme stylesheets, scripts, and image assets. If you leave this variable blank all links will resolve correctly except those pointing to home. ↩1
/