Allow empty menu items

This commit is contained in:
Mimi 2020-04-25 21:56:56 +08:00
parent 75695df76a
commit a527bfdf11
4 changed files with 10 additions and 13 deletions

View File

@ -3,12 +3,6 @@
# See: https://theme-next.org/docs/theme-settings/ # See: https://theme-next.org/docs/theme-settings/
# --------------------------------------------------------------- # ---------------------------------------------------------------
# If false, merge configs from `_data/next.yml` into default configuration (rewrite).
# If true, will fully override default configuration by options from `_data/next.yml` (override). Only for NexT settings.
# And if true, all config from default NexT `_config.yml` have to be copied into `next.yml`. Use if you know what you are doing.
# Useful if you want to comment some options from NexT `_config.yml` by `next.yml` without editing default config.
override: false
# Console reminder if new version released. # Console reminder if new version released.
reminder: false reminder: false
@ -116,11 +110,11 @@ darkmode: false
# When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives). # When running the site in a subdirectory (e.g. yoursite.com/blog), remove the leading slash from link value (/archives -> archives).
# External url should start with http:// or https:// # External url should start with http:// or https://
menu: menu:
home: / || fa fa-home #home: / || fa fa-home
#about: /about/ || fa fa-user #about: /about/ || fa fa-user
#tags: /tags/ || fa fa-tags #tags: /tags/ || fa fa-tags
#categories: /categories/ || fa fa-th #categories: /categories/ || fa fa-th
archives: /archives/ || fa fa-archive #archives: /archives/ || fa fa-archive
#schedule: /schedule/ || fa fa-calendar #schedule: /schedule/ || fa fa-calendar
#sitemap: /sitemap.xml || fa fa-sitemap #sitemap: /sitemap.xml || fa fa-sitemap
#commonweal: /404/ || fa fa-heartbeat #commonweal: /404/ || fa fa-heartbeat

View File

@ -1,9 +1,11 @@
<div class="site-brand-container"> <div class="site-brand-container">
<div class="site-nav-toggle"> <div class="site-nav-toggle">
<div class="toggle" aria-label="{{ __('accessibility.nav_toggle') }}"> <div class="toggle" aria-label="{{ __('accessibility.nav_toggle') }}">
<span class="toggle-line toggle-line-first"></span> {%- if theme.menu %}
<span class="toggle-line toggle-line-middle"></span> <span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-last"></span> <span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
{%- endif %}
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
{% import 'menu-item.njk' as menu_item with context %} {% import 'menu-item.njk' as menu_item with context %}
<nav class="site-nav">
{%- if theme.menu %} {%- if theme.menu %}
<nav class="site-nav">
<ul id="menu" class="main-menu menu"> <ul id="menu" class="main-menu menu">
{%- for name, path in theme.menu %} {%- for name, path in theme.menu %}
{%- set respath = path %} {%- set respath = path %}
@ -30,5 +30,5 @@
</li> </li>
{%- endif %} {%- endif %}
</ul> </ul>
{%- endif %}
</nav> </nav>
{%- endif %}

View File

@ -11,6 +11,7 @@ NexT.boot.registerEvents = function() {
document.querySelector('.site-nav-toggle .toggle').addEventListener('click', () => { document.querySelector('.site-nav-toggle .toggle').addEventListener('click', () => {
event.currentTarget.classList.toggle('toggle-close'); event.currentTarget.classList.toggle('toggle-close');
var siteNav = document.querySelector('.site-nav'); var siteNav = document.querySelector('.site-nav');
if (!siteNav) return;
var animateAction = siteNav.classList.contains('site-nav-on') ? 'slideUp' : 'slideDown'; var animateAction = siteNav.classList.contains('site-nav-on') ? 'slideUp' : 'slideDown';
if (typeof Velocity === 'function') { if (typeof Velocity === 'function') {