Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
www
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Marcus
www
Commits
2cf5c92a
Unverified
Commit
2cf5c92a
authored
7 years ago
by
Tom Wiesing
Browse files
Options
Downloads
Patches
Plain Diff
Update the menu
parent
b7ab7309
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+5
-1
5 additions, 1 deletion
README.md
_config.yml
+4
-2
4 additions, 2 deletions
_config.yml
_includes/menu_single.html
+19
-0
19 additions, 0 deletions
_includes/menu_single.html
_includes/menu_sub.html
+29
-13
29 additions, 13 deletions
_includes/menu_sub.html
with
57 additions
and
16 deletions
README.md
+
5
−
1
View file @
2cf5c92a
...
...
@@ -73,6 +73,7 @@ The menu of the page is defined in the ``_config.yml`` file.
It consists of a set of items, that are defined by the following keys:
*
`url`
- The (internal or external) url to the page. If internal, must be relative to the root directory.
*
`active`
- URL to a folder under which the item should automatically be expanded (if applicable).
*
`folder`
- Instead of using
`url`
, the
`folder`
can be used to create a submenu pointing to a specific folder.
*
`items`
- A list of items for submenus.
*
`external`
- If set to
`true`
, assumes that
`url`
is external to the page.
...
...
@@ -97,7 +98,7 @@ It consists of a set of items, that are defined by the following keys:
2.
An item specifies the
`items`
key. Here the items are used accordingly.
3.
An item specifies both the
`folder`
and
`items`
keys. The items for both cases are automatically merged.
Because submenus are not clickable, the
`url`
for submenus is ignored.
Because submenus are not clickable, the
`url`
for submenus is ignored
when building the menu
.
Furthermore, if these are mixed between folders and static items, the folders will always show first.
```
yaml
...
...
@@ -115,6 +116,9 @@ Furthermore, if these are mixed between folders and static items, the folders wi
url
:
'
https://cs.fau.de/'
```
A submenu is automatically expanded if any of the submenu items inside it are clicked.
Alternatively, if the menu item contains an
`active`
key, it is checked as well.
### Working locally
If you want to do more than the occasional editing, you'll soon realise GitHub's editor and preview are too limited.
...
...
This diff is collapsed.
Click to expand it.
_config.yml
+
4
−
2
View file @
2cf5c92a
permalink
:
pretty
permalink
:
/news/:year/:month/:day/:title/
# Setup
title
:
KWARC
...
...
@@ -11,7 +11,6 @@ paginate_path: "/news/page:num/"
blog_path
:
"
/news/"
future
:
True
gems
:
-
jemoji
-
jekyll-paginate
-
jekyll-github-metadata
-
jekyll-redirect-from
...
...
@@ -44,7 +43,10 @@ fontawesome: font-awesome-4.7.0
menu
:
-
title
:
'
News'
url
:
'
/news/'
active
:
'
/news/'
-
title
:
'
People'
active
:
'
/people/'
items
:
-
title
:
'
Current
Members'
url
:
'
/people/'
...
...
This diff is collapsed.
Click to expand it.
_includes/menu_single.html
+
19
−
0
View file @
2cf5c92a
...
...
@@ -2,8 +2,27 @@
This page creates a single (non-submenu) item. It expects `item` as a variable.
{% endcomment %}
{% assign menu_active = false %}
{% assign base_folder = page.url | split: '/' %}
{% assign base_folder = base_folder[1] %}
{% assign represents = item.active | split: '/' %}
{% assign represents = represents[1] %}
{% if represents %}
{% if base_folder == represents %}
{% assign menu_active = true %}
{% endif %}
{% endif %}
{% if page.url == item.url %}
{% assign menu_active = true %}
{% endif %}
{% unless item.menu_hidden %}
<li
{%
if
menu_active
%}
class=
"active"
{%
endif
%}
{%
if
page.url =
=
item.url
%}
class=
"active"
{%
endif
%}
>
{% if item.external %}
...
...
This diff is collapsed.
Click to expand it.
_includes/menu_sub.html
+
29
−
13
View file @
2cf5c92a
...
...
@@ -5,21 +5,37 @@
{% unless item.menu_hidden %}
{% assign base_folder = page.url | split: '/' %}
<!-- if we are in the right folder, we are active -->
{% if base_folder[1] == item.folder %}
{% assign menu_active = true %}
{% else %}
{% assign menu_active = false %}
{% for item in (item.items | where: "url", page.url) %}
{% unless item.external %}
{% assign base_folder = base_folder[1] %}
{% assign represents = item.active | split: '/' %}
{% assign represents = represents[1] %}
{% assign menu_active = false %}
{% if base_folder %}
{% if item.folder %}
{% if base_folder == item.folder %}
{% assign menu_active = true %}
<!-- active because {{item}} -->
{% endunless %}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% if represents %}
{% if base_folder == represents %}
{% assign menu_active = true %}
{% endif %}
{% endif %}
{% unless menu_active %}
{% for it in item.items %}
{% if page.url == it.url %}
{% unless it.external %}
{% assign menu_active = true %}
{% endunless %}
{% endif %}
{% endfor %}
{% endunless %}
<!-- Find the current folder -->
{% assign item_folder = item.folder %}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment