wcoder.github.io

My tech blog

CC-BY-SA-4.0 License

Stars
3

Tech blog

The site uses Jekyll, a static site generator. GitHub Pages, where the site is hosted, natively supports Jekyll so every time someone pushes to this repository, the website will be built and updated. For hosting it yourself, see:

Setting up a local copy of the website

Manual setup with Ruby

All the documentation is available here:

For run safe github-pages version locally:

bundle exec jekyll serve

Note: you can add the --watch option when running jekyll serve to let Jekyll watch for file changes, which means the site will be rebuilt when a file is modified.

Note 2: on case-insensitive file systems like on Windows and Mac OS X you'll run into redirect loops for some URLs. The workaround is to disable redirects locally by removing the gems: jekyll-redirect-from entry from _config.yml.

Trobleshooting

with nokogiri gem on macOS:

gem install nokogiri -- --use-system-libraries --with-xml2-include=/usr/include/libxml2 --with-xml2-lib=/usr/lib/

Docker

docker-compose up

The site should now be running locally...

Repository structure

  • _includes - special folder contains snippets that can be included via {% include file.html %} in other pages
  • _layouts - special folder contains the layouts that are shared between pages. Layouts can be inherited, the root layout is base.html.
  • _posts - special folder, contains the source pages for the blog section, see Writing a blog post
  • _site - the output of the generated site is stored here by default, this folder only exists after Jekyll built the site

Writing a blog post

Blogging is very easy with Jekyll. Simply add a new Markdown file to the _posts folder following the file name convention: YEAR-MONTH-DAY-title.md

Make sure to not include special characters in the file name. The blog entry's publishing date is automatically extracted from the file name.

Additional features

  • original_url - link to original content.
  • tags - list of tags.
  • locale - language of the content (sample: en_US, default: site.locale).
  • layout.content_type - content type of the page (post: article, default: website).

 


© 2018-now Yauheni Pakala