tomjoht / documentation-theme-jekyll

A Jekyll-based theme designed for documentation and help systems. See the link for detailed instructions on setting up and configuring everything.

Home Page:http://idratherbewriting.com/documentation-theme-jekyll/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Project version as variable

chraibi opened this issue · comments

Is it possible to define a variable, say project_version in _config.html

and use it in one of the sidebars as {{site.project_version}}?

I tried this already but it did not render correctly.

Any idea why not?

I also would like to automatically update the project verison number that is used in this theme. I found a useful jekyll pluggin that does almost everything I want : jekyll-version-plugin. Once this is installed, you only need to add {% project_version %} to a markdown file and it will replace this with the version tag obtained from the git repository.

However, this does not work in the sidebar of this theme:

entries:
- title: sidebar
  product: Jekyll Doc Theme
  version: 6.0
  folders:

Simply replacing 6.0 with {% project_version %} generates the error

found character that cannot start any token while scanning for the next token

I tried naively to "escape" this sequence with more brackets and quotes, but I couldn't find a way that would work. It would be extremely useful for me if there was a way to fix this!

I found a workaround to this, but it involves editing one of the template files:

  1. Add gem 'jekyll_version_plugin', group: :jekyll_plugins to the Gemfile, and then execute bundle update .
  2. Find the file _includes\sidebar.html, and then
  3. replace the single occurence of {{sidebar[0].version}} with {% project_version %}.