jekyll-materialdocs 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +20 -0
  3. data/_includes/menu.html +7 -4
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1895bc500d1ec854345472bd4acc73ba25c4d090
4
- data.tar.gz: ddc820879be332802168dcc390d68faaf5f92603
3
+ metadata.gz: a5aaf7971173fca40d934912740c086a9b199f6b
4
+ data.tar.gz: 448aebc5c5c8105f10109bc87865953b0696c826
5
5
  SHA512:
6
- metadata.gz: 5a87133f9901957bc2268c0d279683b1c80fab40051155c51369d61aea4e4eaa6232d287fc8ed49f532cb42863ae6852cd3d8da901a4f71f282ed3a1f6a1c740
7
- data.tar.gz: 487a21df203745a6273bf14e5d103fbc157b76095172b80cedacbf1520128b22aa9bdce99b8044aeeefaa4eeb0b113e0cba33ea3f0e32f436a8c02eec5d1f604
6
+ metadata.gz: fec6ca8d038b2502410e5f215e9d29e5dee3be541a3729f3bbeb30970247c46627648756bc23bc4ec02c82a201c73303b89d8b469147b49542a35dbe3ae972f6
7
+ data.tar.gz: 0f5af8d5269638ba71c96fea5defb36a66dc8ae74d5bac3d0b83b30c66de39a2ff8325bde8e3afd661deda4468a0a04c01b2a76820b9d2e4f74c5c65e1ee0f43
data/README.md CHANGED
@@ -60,12 +60,32 @@ MaterialDocs supports changing the color scheme by setting `mdl_colors` in _conf
60
60
  MaterialDocs supports a few optional custom values in the YAML front matter.
61
61
  ```yaml
62
62
  menu: Example Page # will use this as the menu item text instead of title, set to false to remove from menu
63
+ tab: true # will open this page in a new tab
63
64
  parent: index.md # will make this menu item a child of the index.md item
64
65
  weight: 2 # smaller weights rise to the top of the menu
65
66
  mdl_colors: deep_orange-blue # override global color scheme for this page
66
67
  search: false # hides this page from search results
67
68
  ```
68
69
 
70
+ ## Menu Data File
71
+
72
+ MeterialDocs supports data-driven menus in `_data/nav.yml`. This can be used to add custom or external links to the menu. Data-driven menu items support all menu-related YAML front matter options. Additionally, data-driven menu items support the `id` option, which can be referenced in `parent`. An example `nav.yml` is shown here.
73
+
74
+ ```yaml
75
+ - title: "External Menu Item"
76
+ url: "https://example.com"
77
+ tab: true # opens this link in a new tab
78
+ id: example # will be used as a parent item
79
+
80
+ - title: "Child Menu Item"
81
+ url: "https://example.com"
82
+ parent: example # will make this item a child of the item above (not displayed when menu_style is set to 'dropdown')
83
+
84
+ - title: "Another Child Menu Item"
85
+ url: "https://example.com"
86
+ parent: about.md # will make this item a child of the about.md item
87
+ ```
88
+
69
89
  ## Contributing
70
90
 
71
91
  Bug reports and pull requests are welcome on GitHub at https://github.com/chromatical/jekyll-materialdocs.
data/_includes/menu.html CHANGED
@@ -1,16 +1,19 @@
1
1
  {% assign sorted_pages = site.pages | sort: 'weight'%}
2
+ {% if site.data.nav %}
3
+ {% assign sorted_pages = sorted_pages | concat: site.data.nav | sort: 'weight' %}
4
+ {% endif %}
2
5
  {% for node in sorted_pages %}
3
6
  {% if node.menu != false %}
4
7
  {% if node.menu or node.title %}
5
8
  {% unless node.parent %}
6
- <a class="mdl-navigation__link parent {% if node.url == page.url or page.parent == node.path %}is-active{% endif %}" href="{{ node.url | absolute_url }}">{% if node.menu %}{{ node.menu }}{% else %}{{ node.title }}{% endif %}</a>
7
- {% if site.menu_style != 'dropdown' or node.url == page.url or page.parent == node.path %}
9
+ <a class="mdl-navigation__link parent{% if node.url == page.url or page.parent and page.parent == node.path %} is-active{% endif %}" href="{{ node.url | absolute_url }}"{% if node.tab %} target="_blank"{% endif %}>{% if node.menu %}{{ node.menu }}{% else %}{{ node.title }}{% endif %}</a>
10
+ {% if site.menu_style != 'dropdown' or node.url == page.url or page.parent and page.parent == node.path %}
8
11
  {% for child in sorted_pages %}
9
12
  {% if child.menu != false %}
10
13
  {% if child.menu or child.title %}
11
14
  {% if child.parent %}
12
- {% if child.parent == node.path %}
13
- <a class="mdl-navigation__link child {% if child.url == page.url %}is-active{% endif %}" href="{{ child.url | absolute_url }}">{% if child.menu %}{{ child.menu }}{% else %}{{ child.title }}{% endif %}</a>
15
+ {% if child.parent == node.path or child.parent == node.id %}
16
+ <a class="mdl-navigation__link child{% if child.url == page.url %} is-active{% endif %}" href="{{ child.url | absolute_url }}"{% if child.tab %} target="_blank"{% endif %}>{% if child.menu %}{{ child.menu }}{% else %}{{ child.title }}{% endif %}</a>
14
17
  {% endif %}
15
18
  {% endif %}
16
19
  {% endif %}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-materialdocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James King
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-14 00:00:00.000000000 Z
11
+ date: 2018-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jekyll