Skip to content

Commit

Permalink
[Features] Add external link support for submenu
Browse files Browse the repository at this point in the history
  • Loading branch information
zhonger committed Apr 3, 2024
1 parent 74511fe commit ded86b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions _data/collections.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
url: '/tech/new-theme-h2o-ac.html'
- name: '快速入门'
url: '/tech/new-theme-h2o-ac.html'


- name: 'Guide'
url: 'https://lisz.me/tech/new-theme-h2o-ac.html'
16 changes: 13 additions & 3 deletions _includes/layouts/submenu.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@ <h4>
</svg>{{ collection.name }}
</h4>
<ul>
{% for article in collection.articles %}
<li><a href="{{ article.url | prepend: site.baseurl }}">{{ article.name }}</a></li>
{% endfor %}
{% for article in collection.articles %}
<li>
{% if article.url contains "://" %}
<a href="{{ article.url }}" class="extlinks">
{{ article.name }}
</a>
{% else %}
<a href="{{ article.url | prepend: site.baseurl }}">
{{ article.name }}
</a>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
{% endfor %}
Expand Down

0 comments on commit ded86b6

Please sign in to comment.