Skip to content

Commit

Permalink
Merge branch 'simplify-special-page-usage'
Browse files Browse the repository at this point in the history
# Conflicts:
#	_includes/navbar.html
  • Loading branch information
sylhare committed May 25, 2019
2 parents a4b970d + 10d7002 commit d2784f8
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 49 deletions.
33 changes: 16 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,13 @@ subtitle: "This is a subtitle"
feature-img: "assets/img/sample.png"
permalink: /about.html # Set a permalink your your page
hide: true # Prevent the page title to appear in the navbar
icon: "fa-search" # Will Display only the fontawesome icon (here: fa-search) and not the title
tags: [sample, markdown, html]
---
```

The hide only hides your page from the navigation bar, it is however still generated and can be access through its link. Use the `_draft` folder to keep files from being generated on your site.
The hide only hides your page from the navigation bar, it is however still generated and can be access through its link.
Use the `_draft` folder to keep files from being generated on your site.

### Layout: Default

Expand Down Expand Up @@ -314,22 +316,25 @@ gallery: "assets/img/pexels"
### Search
The search feature is based on [Simple-Jekyll-search](https://github.com/christian-fei/Simple-Jekyll-Search) there is a `search.json` file that will create a list of all of the site posts, pages and portfolios.
The search feature is based on [Simple-Jekyll-search](https://github.com/christian-fei/Simple-Jekyll-Search)
there is a `search.json` file that will create a list of all of the site posts, pages and portfolios.
Then there's a `search.js` displaying the formatted results entered in the `search.html` page.
The search page can be hidden with the `hide` option. You can remove the icon by removing `icon`:
The search page can be enable/disable in the navigation bar through the `_config.yml` via:
```yml
special_page:
search:
icon: "search"
enabled: true
---
layout: search
title: Search
icon: "search"
---
```

### Tags

Tags should be placed between `[]` in your post metadata. Separate each tag with a comma. Tags are recommended for posts and portfolio items.
Tags should be placed between `[]` in your post metadata. Separate each tag with a comma.
Tags are recommended for posts and portfolio items.

For example:

Expand All @@ -344,18 +349,12 @@ tags: [sample, markdown, html]
> Tags are case sensitive `Tag_nAme``tag_name`
All the tags will be listed in `tags.html` with a link toward the pages or posts.
The tags page can be enable/disable in the navigation bar through the `_config.yml` via:

```yml
special_page:
tags:
icon: "tags"
enabled: true
```
The Tag page can be hidden with the `hide` option. You can remove the icon by removing `icon` (like for the search page).

## Template as a Gem

You can use Type-on-strap as a [gem](https://rubygems.org/gems/type-on-strap). Checkout an example in the [gem-demo branch](https://github.com/Sylhare/Type-on-Strap/tree/gem-demo).
You can use Type-on-strap as a [gem](https://rubygems.org/gems/type-on-strap).
Checkout an example in the [gem-demo branch](https://github.com/Sylhare/Type-on-Strap/tree/gem-demo).
To make the feature pages available in from the gem I created them as layouts that can be invoked in the pages folder.

So if you're using the template as a theme, Make sure you have:
Expand Down
8 changes: 0 additions & 8 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ theme_settings:
disqus_shortname:
katex: true # Enable if using math markup

special_page:
search:
icon: "search"
enabled: true
tags:
icon: "tags"
enabled: true

# Localization strings
str_follow_on: "Follow on"
str_rss_follow: "Follow RSS feed"
Expand Down
28 changes: 7 additions & 21 deletions _includes/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,33 +21,19 @@ <h1 class="site-title">

<!-- Menu -->
<ul class="hide">
<!-- Auto Generation of NORMAL pages in the navbar -->
{% assign name_page = "" %}

{% for page in site.pages %}
{% if page.title and page.hide != true %}
{% if name_page contains page.title %}
{% else %}
<li class="separator"> | </li>
<li>
<a class="clear" aria-label="{{ page.title }}" title="{{ page.title }}" href="{{ page.url | relative_url }}">
</a>
</li>
{% endif %}
{% assign name_page = page.title | append: name_page %}
{% endif %}
{% endfor %}

<!-- Auto Generation of SPECIAL pages in the navbar -->
{% for item in site.theme_settings.special_page %}
{% if item[1].enabled %}
{% unless page.title == null or page.hide or name_page contains page.title %}
<li class="separator"> | </li>
<li>
<a class="clear" href="{{ item[0] | relative_url }}" aria-label="{{ item[0] }}" title="{{item[0]}}">
<i class="fa fa-{{ item[1].icon }}" aria-hidden="true"></i>
</a>
<a class="clear" aria-label="{{ page.title }}" title="{{ page.title }}" href="{{ page.url | relative_url }}">
{% if page.icon %} <i class="fa {{ page.icon }}" aria-hidden="true"></i>
{% else %} {{ page.title }} {% endif%}
</a>
</li>
{% endif %}
{% endunless %}
{% assign name_page = page.title | append: name_page %}
{% endfor %}
</ul>

Expand Down
2 changes: 1 addition & 1 deletion pages/search.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ title: Search
permalink: /search/
subtitle: "What are you looking for?"
feature-img: "assets/img/pexels/search-map.webp"
hide: true
icon: "fa-search"
---
2 changes: 1 addition & 1 deletion pages/tags.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
layout: tags
title: Tags
permalink: /tags/
hide: true
icon: "fa-tags"
---

2 changes: 1 addition & 1 deletion type-on-strap.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |spec|
spec.name = "type-on-strap"
spec.version = "1.1.1"
spec.version = "1.3.0"
spec.authors = ["Sylhare","Rohan Chandra"]
spec.email = ["[email protected]", "[email protected]"]

Expand Down

0 comments on commit d2784f8

Please sign in to comment.