mirror of https://github.com/apache/lucene.git
62 lines
3.3 KiB
Plaintext
62 lines
3.3 KiB
Plaintext
|
= Working with Jekyll
|
||
|
:toc:
|
||
|
|
||
|
The Solr Ref Guide uses Jekyll to build the HTML version of the site.
|
||
|
|
||
|
== What is Jekyll?
|
||
|
|
||
|
Jekyll is a static site generator, meaning that it takes some set of documents and produces HTML pages. It allows for templating of the pages, so each page has the same look and feel without having to code headers, footers, logos, etc., into every page.
|
||
|
|
||
|
Jekyll is an open source project written in Ruby, online at https://jekyllrb.com/.
|
||
|
|
||
|
== Jekyll-Asciidoctor Plugin
|
||
|
We use a plugin for Jekyll from the Asciidoctor project to integrate Jekyll with Asciidoc formatted content. The source for the plugin is available at https://github.com/asciidoctor/jekyll-asciidoc.
|
||
|
|
||
|
This plugin allows us to use Asciidoctor-style variables with Jekyll, instead of having to maintain two sets of the same variables (one for HTML version and another for PDF version).
|
||
|
|
||
|
== Jekyll Basics
|
||
|
|
||
|
The following sections describe the main features of Jekyll that you will encounter while working with the Solr Ref Guide.
|
||
|
|
||
|
=== _config.yml
|
||
|
|
||
|
The `_config.yml` is a global configuration file that drives many of the options used when building the site (particularly in our use of Jekyll).
|
||
|
|
||
|
We have templatized `_config.yml` so in our use of Jekyll you will find it as `solr-ref-guide/_config.yml.template`. This allows us to define some variables during the build, and use common Lucene/Solr build parameters (such as versions, etc.).
|
||
|
|
||
|
=== Front Matter
|
||
|
|
||
|
Front matter for Jekyll is like a header that defines the title of the page, and any other variables that may be helpful or even required when rendering the page.
|
||
|
|
||
|
Every document that will be converted to HTML *must* include at least the page title at the top of the page.
|
||
|
|
||
|
The Solr Ref Guide uses the front matter to define the "short name" and permanent URL of a page, and to define the children of a page. The list of children is used to build the site navigation menu that appears to the left of each page's content.
|
||
|
|
||
|
Many guides to Jekyll also say that defining the layout in the front matter is required. However, since we only have one layout for all pages, we have defined this as a default.
|
||
|
|
||
|
=== Layouts
|
||
|
|
||
|
Layouts define the "look and feel" of each page.
|
||
|
|
||
|
Jekyll uses Liquid for page templates.
|
||
|
|
||
|
For our implementation of Jekyll, layouts are found in `solr-ref-guide/src/_layouts`
|
||
|
|
||
|
=== Includes
|
||
|
|
||
|
Include files are usually small files that are pulled into a layout when a page is being built. They are Liquid templates that define an area of the page. This allows flexibility across layouts - all pages can have the same header without duplicating code, but different pages could have different menu options.
|
||
|
|
||
|
Include files that we use define the top navigation, the page header, the page footer, and tables of contents.
|
||
|
|
||
|
For our implementation of Jekyll, include files are found in `solr-ref-guide/src/_includes`.
|
||
|
|
||
|
=== Data Files
|
||
|
|
||
|
Data files include data such as lists, that should be included in each page. The left-hand navigation is an example of a data file.
|
||
|
|
||
|
For our implementation of Jekyll, data files are found in `solr-ref-guide/src/_data`.
|
||
|
|
||
|
== Building the HTML Site
|
||
|
|
||
|
An Ant target `build-site` will build the full HTML site. This target builds the navigation for the left-hand menu, and converts all `.adoc` files to `.html`, including navigation and inter-document links.
|