Skip to content
Snippets Groups Projects
Unverified Commit 9df3472c authored by Tom Wiesing's avatar Tom Wiesing
Browse files

Allow external and static items in menu

parent b3bf7215
No related branches found
No related tags found
No related merge requests found
......@@ -29,7 +29,7 @@ See the above links for details.
This is a [*static website*](http://en.wikipedia.org/wiki/Static_web_page) automatically generated with [Jekyll](http://jekyllrb.com/) by [GitHub Pages](http://pages.github.com/).
### Editing pages online with GitHub
### Editing pages online with GitHub / GitLab
You can edit any page by following the `Edit this page` link in the Quick links nav bar.
Alternatively, you can directly navigate to the corresponding `.md` (Markdown) file in GitHub.
......@@ -50,6 +50,30 @@ Other reasons why GitHub's preview may not correspond to the final results are:
- Use of [Liquid templates](https://github.com/Shopify/liquid/wiki/Liquid-for-Designers) in the source.
- Use of special purpose markup, HTML, and scripts, such as mathematical excerpts written in [MathJax](http://mathjax.org/).
### Editing the menu
The menu of the page is defined in the ``_config.yml`` file.
It contains three kinds of items:
1. **Folder menu**. An expandable sub-menu that contains all pages in a specific folder.
2. **Internal links**. A single link to a specific page.
3. **External links**. A link to an external page that automatically opens in a new tab.
The items can be defined by inserting them into the appropriate place in the list of menu items.
They look like
```yaml
# A folder menu for the /people/ folder
- title: 'People'
folder: 'people'
# A single link to the /news/ page.
- title: 'News'
url: '/news/'
# An external link to the bibliography page
- title: 'Bibliography'
external: true
url: 'https://kwarc.github.io/bibs/'
```
### Working locally
If you want to do more than the occasional editing, you'll soon realise GitHub's editor and preview are too limited.
......
......@@ -17,7 +17,11 @@ gems:
- jekyll-github-metadata
- jekyll-redirect-from
exclude: ['public/*.md', 'public/*.html', '*/README.md', '*.synctex.gz', '*.aux', '*.nav', '*.out', '*.snm', '*.tex', '*.log', '*.toc']
exclude:
- 'public/materialize/materialize-src/*'
- 'public/*.md'
- 'public/*.html'
- '*/README.md'
# About/contact
......@@ -46,6 +50,9 @@ fontawesome: font-awesome-4.7.0
menu:
- title: 'People'
folder: 'people'
- title: 'Bibliography'
external: true
url: 'https://kwarc.github.io/bibs/'
- title: 'Research'
folder: 'research'
- title: 'Systems'
......@@ -56,6 +63,12 @@ menu:
folder: 'students'
- title: 'Teaching'
folder: 'teaching'
- title: 'News'
url: '/news/'
- title: 'Contact'
url: '/contact/'
defaults:
-
......
......@@ -28,40 +28,50 @@
{% assign base_folder = url_parts[1] %}
{% assign sorted_pages = site.pages | sort:"menu_order" %}
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
{% for node in site.menu %}
<li class="bold">
<a class="collapsible-header {% if base_folder == node.folder %}active{% endif %}">{{ node.title }}</a>
<div class="collapsible-body">
<ul>
{% for sub in sorted_pages %}
{% assign sub_parts = sub.url | split: '/' %}
{% assign sub_url = sub_parts | last %}
{% assign sub_folder = sub_parts[1] %}
{% if sub_folder == node.folder %}
{% if sub.hidden == false %}
<li {% if sub_url == base_url %}class="active"{% endif %}>
<a href="{{ sub.url }}">
{% if sub.menu_title %}
{{ sub.menu_title }}
{% else %}
{{ sub.title }}
{% endif %}
</a>
</li>
{% endif%}
{% endif %}
{% endfor %}
</ul>
</div>
</li>
{% endfor %}
</ul>
</li>
<li {% if page.url == "/news/" %} class="active" {% endif %}><a href="{{ site.baseurl }}/news/">News</a></li>
<li {% if page.url == "/contact/" %} class="active" {% endif %}><a href="{{ site.baseurl }}/contact/">Contact</a></li>
{% for node in site.menu %}
{% if node.folder %}
<li class="no-padding">
<ul class="collapsible collapsible-accordion">
<li class="bold">
<a class="collapsible-header {% if base_folder == node.folder %}active{% endif %}">{{ node.title }}</a>
<div class="collapsible-body">
<ul>
{% for sub in sorted_pages %}
{% assign sub_parts = sub.url | split: '/' %}
{% assign sub_url = sub_parts | last %}
{% assign sub_folder = sub_parts[1] %}
{% if sub_folder == node.folder %}
{% if sub.hidden == false %}
<li {% if sub_url == base_url %}class="active"{% endif %}>
<a href="{{ sub.url }}">
{% if sub.menu_title %}
{{ sub.menu_title }}
{% else %}
{{ sub.title }}
{% endif %}
</a>
</li>
{% endif%}
{% endif %}
{% endfor %}
</ul>
</div>
</li>
</ul>
</li>
{% else if node.url %}
<li
{% if page.url == node.url %}
class="active"
{% endif %}
>
<a href="{% unless node.external %}{{ site.baseurl }}{% endunless %}{{ node.url }}" {% if node.external %}target="_blank"{% endif %}>{{node.title}}</a>
</li>
{% endif %}
{% endfor %}
</li>
</ul>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment