cmd: theme data file support menu

This commit is contained in:
thisLight 2021-08-30 13:50:31 +08:00
parent e7fb4f86bd
commit f1b58aa447
3 changed files with 28 additions and 15 deletions

View file

@ -1,3 +1,7 @@
menu:
Home: /
Archives: /archives
copyright_addtional: "" copyright_addtional: ""
copyright_year_string: "2020-2021" copyright_year_string: "2020-2021"

View file

@ -1,12 +1,9 @@
# html lang
language:
- zh-cn
- en
# main menu navigation # main menu navigation
menu: menu:
Home: / Home: /
About: /about
Contact: /contact
Archives: /archives Archives: /archives
# stylesheets loaded in the <head> # stylesheets loaded in the <head>
@ -27,10 +24,10 @@ copyright_year_string: "2020-2021"
theme_self_claim: true theme_self_claim: true
about_this_blog: 这里是Rubicon's Rubicon。我在无界之点的偏安之地。 about_this_blog: This blog is created with Classical Material Desgin theme, which is a original taste of Material Design for hexo.
my_mastodon: "https://mastodon.social/@thislight" my_mastodon: https://mastodon.example.com/@example
footer_links: footer_links:
GitHub: "https://github.com/thislight" Link 1: "https://example.org"
GitLab: "https://gitlab.com/thislight" Link 2: "https://example.com"

View file

@ -46,17 +46,29 @@
</head> </head>
<body> <body>
<ul id="nav-mobile" class="sidenav"> <ul id="nav-mobile" class="sidenav">
{% for key in Object.keys(theme.menu) %} {% if site.data.theme.menu %}
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li> {% for key in Object.keys(site.data.theme.menu) %}
{% endfor %} <li><a href="{{ site.data.theme.menu[key] }}">{{ key }}</a></li>
{% endfor %}
{% else %}
{% for key in Object.keys(theme.menu) %}
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
{% endfor %}
{% endif %}
</ul> </ul>
<nav class="light-blue lighten-1" role="navigation"> <nav class="light-blue lighten-1" role="navigation">
<a href="#" data-target="nav-mobile" class="sidenav-trigger"><div class="mdi mdi-menu"></div></a> <a href="#" data-target="nav-mobile" class="sidenav-trigger"><div class="mdi mdi-menu"></div></a>
<div class="nav-wrapper"> <div class="nav-wrapper">
<ul class="right hide-on-med-and-down"> <ul class="right hide-on-med-and-down">
{% for key in Object.keys(theme.menu) %} {% if site.data.theme.menu %}
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li> {% for key in Object.keys(site.data.theme.menu) %}
{% endfor %} <li><a href="{{ site.data.theme.menu[key] }}">{{ key }}</a></li>
{% endfor %}
{% else %}
{% for key in Object.keys(theme.menu) %}
<li><a href="{{ theme.menu[key] }}">{{ key }}</a></li>
{% endfor %}
{% endif %}
</ul> </ul>
</div> </div>
</nav> </nav>