Content categories
The builder engine Jekyll differentiates between two different categories of content:
Thus, all pages of type Page are unordered, while all Blog Posts are orderly. The property of order is only of interest to programmers. To make documents accessible to visitors, navigation options are needed. From the perspective of the Jekyll engine, there are no options for (automatic) structuring Pages for programmers. For Posts, this is quite different.
The Template System J1 structures Page and Post type documents in its way. The template provides you with ready-made programs that structure a website’s content and are accessible to visitors via navigation do. Authors have little exposure to the Jekyll builder engine’s elementary delivery methods to visitors.
J1 provides these navigation components :
-
J1 Navigator, for Page type documents
-
J1 Blog Navigator, for Post type documents
The Posts Explorer is used for navigating blog posts and is discussed in the subsequent J1 Blog Navigator section. The first thing to look at is how documents of the Page type can be made accessible to your visitors.
J1 Navigator
The J1 Navigator component is a module in the sense of J1. Modules are dynamic components and use CSS and Javascript elements to provide the necessary functionality for a website. One of the features provided by the module J1 Navigator is the Menu Bar that provides visitors dropdown menus to browse and select content pages.
Menu managed by the J1 Navigator
The J1 Navigator module offers several other functions, but changes to the menu bar are the most common. To manage the menu bar settings more handy, the settings are separated into a configuration file: ~/_data/modules/navigator_menu.yml
.
Open this file in your editor. The first impression conveys that the menu configuration isn’t that easy either. The configuration is simple, but extensive existing settings appear initially complex.
The menu system supports items with and without submenus (dropdowns). The simplest element in the menu bar is an item that does not create any other sub-menus (dropdowns). The configuration for an entry in Level 0 has the following form:
Configuration of a menu entry of level 0
# ------------------------------------------------------------------------------
# TopLevel item FEATURES (commented out)
#
# - item: Features
# href: /#panel_home_intro
# ------------------------------------------------------------------------------
# Menu SANDBOX
#
- item: Sandbox
href: /pages/public/sandbox/simple/
Add the configuration from above to the file ~/_data/modules/navigator_menu.yml
below the entries of the Learn menu. The result should then look like this:
An entry in Level 1 is helpful to enable a little more options in the menu entries for sandbox documents. The submenu allows you to call up different pages as a dropdown. The configuration for an entry in Level 1 has the following form:
Configuration of a menu entry of level 1
# ------------------------------------------------------------------------------
# Menu SANDBOX
#
- item: Sandbox
sublevel:
- title: Simple Sandbox page
href: /pages/public/sandbox/simple/
icon: pencil
Drop-down menus offer other advantages:
The presented configuration of the sandbox shows that entries are not particularly complicated. Compare the settings of the menu bar of your site with the menu displayed in the browser. The principle of the menu configuration will certainly become a lot clearer quickly and will also help write more extensive entries.
J1 Modules
AsciiDoc macros have already been discussed in the Asciidoc Extensions section. Asciidoc macros, which make J1 Modules usable in websites, are a little more complex. The use of modules requires additional settings in configuration files, but again there are none programming required.
J1 modules are independent Javascript programs integrated into the template system. Modules are listed as Resources (the actual programs) and integrated into the template system with the help of adapters. The adapters, complemental Javascript programs, ensure that no programming is required to use the module. Only suitable settings are necessary for using J1 Modules.
| All programs provided and integrated with J1 are Open Sourceprojects and can be used free. |
The task of Ascidoctor Macros for J1 Modules is to generate the necessary HTML markup within a website, which are required by the connected JavaScript programs to provide the dynamic functions of the website in the browser. The settings ensure the desired behavior of a module. The adapters start the respective Javascript programs when the website is displayed in the browser and run customizations if required.
| Modules are complex J1 components and are certainly not easy to understand. From the perspective of non-programming authors, only the settings of the modules are important. |
Frequently used Asciidoc Macros for J1 modules used to embed lightboxes or galleries of images are:
Asciidoc Markup for single images
.block_title
lightbox::<block_id>[ <images_width>, <images_data_id>, <role="<additional CSS styles>"> ]
Example of a lightbox for single images
If more than a single image is given for a J1 Lightbox block, the images can be grouped to enable a simple sliding functionality through this group of related images. Enabling this function, the group
option needs to be configured for the macro.
Asciidoc Markup for groups of images
.block_title
lightbox::<block_id>[ <images_width>, <images_data_id>, <group_name>, <role="<additional CSS styles>"> ]
Example of a lightbox displaying groups of images
Asciidoc Markup for image galleries
.block_title
gallery::<gallery_id>[ <role="<additional CSS styles>"> ]
Example of an image gallery
| The role parameter for specifying additional CSS styles is optional in all macros and can be omitted. |
A Lightbox is a quite simple J1 Module to include single images or groups of images via a lightbox macro lightbox::
on a page. In particular, displaying images for high resolutions using the image::
macro cannot be used for original sizes on a page. Lightboxes can help here. The images are displayed in smaller sizes but can be expanded to their original resolution by clicking on the image.
Apply the example Lightbox for single images to your new sandbox document simple.adoc
below the dummy text of the first chapter. The given source include the J1 Lightbox Module with an additional dummy text below:
lightbox::images-lightbox-standalone[ 800, {data-images-lightbox--standalone}, role="mb-4"]
lorem:sentences[3]
The parameters in the Asciidoc markup have the following meaning:
images-lightbox-standalone
-
All modules require an ID. The Asciidoc macro generates the necessary HTML markup for the module, but the generated HTML block requires a unique identifier. Modules can use the ID to distinguish between elements of the same type (lightbox for example). For the Lightbox module, the ID can be freely selected. However, it is advisable to derive the ID from the attribute’s name to make uniqueness of the identifier sure.
800
-
Limiting the size (width) of the image displayed on the page to 800 pixels.
data-images-lightbox—standalone
-
The curly brackets address an Asciidoc attribute. The definition of these variables can be found in the global ascidoc attributes file ~/_includes/attributes.asciidoc
.
role="mb-4"
-
Specifying mb-4
(Bootstrap style) adds a CSS style for the lightbox that creates an additional border below the Lightbox element.
In a second step, add the example Lightbox displaying groups of images to the sandbox document below the dummy text in the second chapter. The Asciidoc code for embedding the lightbox with an additional blind text is:
lightbox::images-lightbox-group[ 395, {data-images-lightbox--group}, lb_group, role="mb-4 wm-800" ]
lorem:sentences[3]
The parameters in the Asciidoc markup have the following meaning:
lb_group
-
The Asciidoc attribute data-images-lightbox—group
contains two images. To display both images in the Lightbox, the parameter lb_group
creates a group and you can switch between the images.
role="mb-4 wm-800"
-
Again, the information supplements CSS styles for the lightbox. The styles apply an additional border below the Lightbox and limit the element’s width on the page to 800 pixels.
The lightbox module is quite simple. Only simple Asciidoc variables are required to configure the images.
:data-images-lightbox--standalone: "modules/gallery/old_times/image_02.jpg, GrandPa's 80th Birthday"
:data-images-lightbox--group: "modules/gallery/old_times/image_03.jpg, GrandPa's annual journey, modules/gallery/old_times/image_04.jpg, GrandPa's annual journey"
The module of the simple lightbox is very well suited for individual images. Still, it becomes more difficult to use it for several images, and it is hardly possible to display more than two or three images as a group in a meaningful way. Galleries are a better solution for displaying of image groups, even in large numbers.
The J1 Theme offers the very powerful Justified Gallery-Module for displaying larger groups of images. The configuration is more extensive since the module offers significantly more functions. The example Image gallery clearly shows the various functions.
A picture gallery combines two J1 modules:
Most J1 modules are only required on certain pages. Therefore, loading the required resources only makes sense if the components are used on a page. Which modules will be loaded for a page configured from the Front matter via the resources
parameter of a page. To make use of an image gallery, replace the settings in the Front matter of the simple.adoc
page with the following code:
Extendend resources for galleries
resources: [ clipboard, lightbox, lightGallery, justifiedGallery, rouge ]
| The need to give additional information about a page’s resources (modules) seems cumbersome. Site visitors reject the best pages with good design and excellent content if the page takes too long to be displayed in the browser. In addition to content and design, the performance of a website is essential. Reducing the number of resources for a page will significantly reduce the time required to load a page in a web browser. |
The macro for embedding an image gallery from the example shown macro for image galleries is:
Asciidoc Markup for an image gallery plus additional blind text
gallery::jg_old_times_2[ role="mb-4 wm-800" ]
lorem:sentences[3]
The parameters in the Asciidoc markup have the following meaning:
jg_old_times_2
-
Like any module, a unique ID is required to distinguish elements of the same type. In contrast to the markup of the lightbox lightbox::
, this identifier is not freely selectable and must correspond to the ID of the gallery from the configuration of the module.
role="mb-3 wm-800"
-
As with the lightbox module, the specifications add CSS styles for displaying the element on the page.
It is noticeable that the notation of the markup uses fewer parameters than is the case with the lightbox macro lightbox::
. The reason for this is the outsourcing of the settings to a separate configuration file ~/_data/modules/justifiedGallery.yml
.
Configuration of the gallery jg_old_times_2
# ----------------------------------------------------------------------------
# Old Times 2
#
- gallery:
enabled: true
id: jg_old_times_2
type: image
images_path: /assets/image/modules/gallery/old_times
thumb_path: /assets/image/modules/gallery/old_times
images: [
image_01.jpg, image_02.jpg,
image_03.jpg, image_04.jpg
]
captions_gallery: [
"GrandPa's 80th Birthday",
"GrandPa's 80th Birthday",
"GrandPa's annual journey",
"GrandPa's annual journey"
]
gallery_options:
rowHeight: 200
margins: 5
lightbox_options:
lightbox: lg
mode: lg-fade
cssEasing: cubic-bezier(0.25, 0, 0.25, 1)
As the last step for this section, expand the Asciidoc markup code of the image gallery into the new sandbox document below the dummy text in the second chapter below the Section 1 section.
How do you like the custom sandbox page now?
By adding images, the sandbox page has taken shape. The page has gained some dynamic in the browser but can still be read easily in the source text. The Asciidoc markups remain legible for the author without the website necessarily being called up in the browser. The decisive advantage of the Asciidoc markup language: even complex elements can be written down simple, remain legible, and the meaning stays understood.