Skip to content

Commit edea136

Browse files
authored
Merge pull request #221 from servo/mark-ext-menu-items
Mark external menu items with icon
2 parents d2cdbd8 + 8ded9b5 commit edea136

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

_data/menu.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@
44
"url": "#",
55
"subpages": [
66
{ "title": "Contributing", "url": "/contributing/" },
7-
{ "title": "Servo Book", "url": "https://book.servo.org" },
7+
{ "title": "Servo Book", "url": "https://book.servo.org", "external": true },
88
{ "title": "WPT pass rates", "url": "/wpt/" },
99
{ "title": "Code of Conduct", "url": "/coc/" }
1010
]
1111
},
1212
{ "title": "Download", "url": "/download/" },
1313
{ "title": "Blog", "url": "/blog/" },
14-
{ "title": "Demos", "url": "https://demo.servo.org/" },
14+
{ "title": "Demos", "url": "https://demo.servo.org/", "external": true },
1515
{
1616
"title": "About",
1717
"url": "#",
1818
"subpages": [
1919
{ "title": "About Servo", "url": "/about/" },
20-
{ "title": "Governance", "url": "https://github.com/servo/project/blob/main/governance/README.md" },
20+
{ "title": "Governance", "url": "https://github.com/servo/project/blob/main/governance/README.md", "external": true },
2121
{ "title": "Sponsorship", "url": "/sponsorship/" },
2222
{ "title": "Acknowledgements", "url": "/acknowledgements/" }
2323
]

_includes/ext-link-marker.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<span style="font-size: 0.8em;display:inline-block;margin-left: 4px"><i class="fa-solid fa-up-right-from-square"></i></span>

_includes/header.html

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,32 @@
2525
{% endfor %}
2626
{% endcapture %}
2727
<div class="navbar-item has-dropdown is-hoverable">
28-
<a class="navbar-link{% if link.url == pagedir %} is-active {% endif %}{{ subpage-is-active }}" href="{{ link.url | url }}"{% if link.url contains 'http://' or link.url contains 'https://' %} target="_blank"{% endif %}>
29-
{{ link.title }}
28+
<a
29+
class="navbar-link{% if link.url == pagedir %} is-active {% endif %}{{ subpage-is-active }}"
30+
href="{{ link.url | url }}"
31+
{% if link.external %} target="_blank"{% endif %}
32+
>
33+
{{ link.title }}{% if link.external %}{% include "ext-link-marker.html" %}{% endif %}
3034
</a>
3135
<div class="navbar-dropdown">
3236
{% for sublink in link.subpages %}
33-
<a class="navbar-item{% if sublink.url == pagedir %} is-active{% endif %}" href="{{ sublink.url | url }}"{% if sublink.url contains 'http://' or sublink.url contains 'https://' %} target="_blank"{% endif %}>
34-
{{ sublink.title }}
37+
<a
38+
class="navbar-item{% if sublink.url == pagedir %} is-active{% endif %}"
39+
href="{{ sublink.url | url }}"
40+
{% if sublink.external %} target="_blank"{% endif %}
41+
>
42+
{{ sublink.title }}{% if sublink.external %}{% include "ext-link-marker.html" %}{% endif %}
3543
</a>
3644
{% endfor %}
3745
</div>
3846
</div>
3947
{% else %}
40-
<a class="navbar-item{% if link.url == pagedir %} is-active{% endif %}" href="{{ link.url | url }}"{% if link.url contains 'http://' or link.url contains 'https://' %} target="_blank"{% endif %}>
41-
{{ link.title }}
48+
<a
49+
class="navbar-item{% if link.url == pagedir %} is-active{% endif %}"
50+
href="{{ link.url | url }}"
51+
{% if link.external %} target="_blank"{% endif %}
52+
>
53+
{{ link.title }}{% if link.external %}{% include "ext-link-marker.html" %}{% endif %}
4254
</a>
4355
{% endif %}
4456
{% endfor %}

0 commit comments

Comments
 (0)