Skip to content

Commit 809ab68

Browse files
committed
Added tabs, sytax highlighting and updated bulma
1 parent 7578660 commit 809ab68

40 files changed

+1007
-249
lines changed

README.md

+58-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This is a clean and simple Jekyll Theme built with the [Bulma](https://bulma.io/
1212
* [Colours and Styles](#colours-and-styles)
1313
* [Sidebar Visibility](#sidebar-visibility)
1414
* [Menubar](#menubar)
15+
* [Tabs](#tabs)
1516
* [Google Analytics](#google-analytics)
1617
* [Contributing](#contributing)
1718
* [Development](#development)
@@ -133,7 +134,7 @@ Create a data file in the _data directory and use the following format (if using
133134
134135
For the current page to have an active class, ensure the `link:` format matches your [permalink](https://jekyllrb.com/docs/permalinks/#extensionless-permalinks) format. The above example will work with `permalink: pretty` setting in your `_config.yml`
135136

136-
### Multiple menus
137+
#### Multiple menus
137138

138139
You may make multiple menus in the same file, separated by the label
139140

@@ -157,7 +158,62 @@ You may make multiple menus in the same file, separated by the label
157158
link: /another-example-item/
158159
```
159160

160-
### Google Anaytics
161+
### Tabs
162+
163+
**New in 0.4**
164+
165+
The tabs gets its content from a data file in your site's `_data` directory. Simply set the name of your data file in the page's menubar setting in the frontmatter.
166+
167+
```yml
168+
title: Page with tabs
169+
subtitle: Demo page with tabs
170+
layout: page
171+
show_sidebar: false
172+
menubar: example_menu
173+
tabs: example_tabs
174+
```
175+
176+
Tabs can be used in conjunction with menubar and/or sidebar if you wish.
177+
178+
#### Creating a tabs data file
179+
180+
Create a data file in the _data directory and use the following format (if using yml)
181+
182+
```yml
183+
alignment: is-left
184+
style: is-boxed
185+
size: is-large
186+
items:
187+
- name: Tabs
188+
link: /page-4/
189+
icon: fa-smile-wink
190+
- name: Sidebar
191+
link: /page-1/
192+
icon: fa-square
193+
- name: No Sidebar
194+
link: /page-2/
195+
icon: fa-ellipsis-v
196+
- name: Menubar
197+
link: /page-3/
198+
icon: fa-bars
199+
```
200+
201+
#### Settings
202+
203+
You can control the alignment, style and size of the tabs by using the relevant [Bulma tabs classes](https://bulma.io/documentation/components/tabs/).
204+
205+
#### Active Tab Highlighting
206+
207+
It will automatically mark the active tab based on the current page.
208+
209+
#### Icons
210+
211+
You can add icons to your tab by passing in the [Font Awesome icon class](https://fontawesome.com/icons?d=gallery).
212+
213+
If you don't wish to show icons then simply omit the option from your yaml file.
214+
215+
216+
### Google Analytics
161217

162218
**New in 0.2**
163219

_config.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ plugins:
1616
- jekyll-paginate
1717
- jekyll-feed
1818
- jekyll-seo-tag
19+
- kramdown
20+
- rouge
1921

2022
exclude:
2123
- Gemfile
@@ -50,4 +52,7 @@ defaults:
5052
author: "C.S. Rhymes"
5153
layout: post
5254
image: https://via.placeholder.com/800x600
53-
show_sidebar: false
55+
show_sidebar: false
56+
57+
markdown: kramdown
58+
highlighter: rouge

_data/example_menu.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
link: /page-2/
1212
- name: Page With Menubar
1313
link: /page-3/
14+
- name: Page With Tabs
15+
link: /page-4/
1416
- name: Blog
15-
link: /blog/
16-
- label: Second Example Menu
17-
items:
18-
- name: Item
19-
link: #
17+
link: /blog/

_data/example_tabs.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
alignment: is-left
2+
style: is-boxed
3+
size: is-large
4+
items:
5+
- name: Tabs
6+
link: /page-4/
7+
icon: fa-smile-wink
8+
- name: Sidebar
9+
link: /page-1/
10+
icon: fa-angle-double-right
11+
- name: No Sidebar
12+
link: /page-2/
13+
icon: fa-ellipsis-v
14+
- name: Menubar
15+
link: /page-3/
16+
icon: fa-bars

_data/navigation.yml

+2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,7 @@
77
link: /page-2/
88
- name: Page With Menubar
99
link: /page-3/
10+
- name: Page With Tabs
11+
link: /page-4/
1012
- name: Blog
1113
link: /blog/

_includes/tabs.html

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% if page.tabs %}
2+
{% assign tabs = site.data.[page.tabs] %}
3+
4+
<div class="tabs {% if tabs.size %}{{ tabs.size }}{% endif %} {% if tabs.alignment %}{{ tabs.alignment }}{% endif %} {% if tabs.style %}{{ tabs.style }}{% endif %}">
5+
<ul>
6+
{% for tab in tabs.items %}
7+
<li {% if tab.link == page.url %} class="is-active" {% endif %}>
8+
<a href="{{ tab.link | prepend: site.baseurl }}">
9+
{% if tab.icon %}
10+
<span class="icon is-small"><i class="fas {{ tab.icon }}" aria-hidden="true"></i></span>
11+
{% endif %}
12+
<span>{{ tab.name }}</span>
13+
</a>
14+
</li>
15+
{% endfor %}
16+
</ul>
17+
</div>
18+
{% endif %}

_layouts/default.html

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
</div>
1414
{% endif %}
1515
<div class="column">
16-
<div class="content">
17-
{{ content }}
18-
</div>
16+
{% include tabs.html %}
17+
{{ content }}
1918
</div>
2019
{% if site.posts and page.show_sidebar %}
2120
<div class="column is-4-desktop is-12-tablet">

_layouts/page.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
layout: default
33
---
44

5-
{{ content }}
5+
<div class="content">
6+
{{ content }}
7+
</div>

_sass/_main.scss

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
$family-sans-serif: 'Montserrat', sans-serif;
55
$primary: #188eac !default;
66

7+
$tabs-link-active-color: $primary;
8+
$tabs-link-active-border-bottom-color: $primary;
9+
710
@import "../node_modules/bulma/bulma.sass";
8-
@import "layout";
11+
@import "layout";
12+
@import "syntax"

0 commit comments

Comments
 (0)