Skip to content

Commit a1bb165

Browse files
authored
[docs] Add Github repo icon-link to topbar (#12462)
Add a link to sphinx-doc/sphinx, via an icon on the right of the top-bar
1 parent bcf3242 commit a1bb165

File tree

2 files changed

+50
-7
lines changed

2 files changed

+50
-7
lines changed

doc/_themes/sphinx13/layout.html

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,17 @@
1010

1111
{% block header %}
1212
<div class="pageheader">
13-
<a href="{{ pathto(root_doc)|e }}">
14-
<img src="{{ pathto('_static/sphinx-logo.svg', resource=True) }}" alt="logo" />
15-
</a>
16-
<h1>Sphinx</h1>
13+
<div class="brand">
14+
<a href="{{ pathto(root_doc)|e }}">
15+
<img src="{{ pathto('_static/sphinx-logo.svg', resource=True) }}" alt="logo" />
16+
</a>
17+
<h1>Sphinx</h1>
18+
</div>
19+
<div class="icons">
20+
<a href="https://github.com/sphinx-doc/sphinx" title="{{ _('Source Code') }}" target="_blank">
21+
{{ github_icon() }}
22+
</a>
23+
</div>
1724
</div>
1825
{% endblock %}
1926

@@ -60,3 +67,18 @@ <h3>{{ _('On this page') }}</h3>
6067
{% trans sphinx_version=sphinx_version|e %}Created using <a href="https://www.sphinx-doc.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
6168
</div>
6269
{%- endblock %}
70+
71+
{% macro github_icon() %}
72+
<svg
73+
stroke="currentColor"
74+
fill="currentColor"
75+
stroke-width="0"
76+
viewBox="0 0 16 16"
77+
class="gh-source"
78+
>
79+
<path
80+
fill-rule="evenodd"
81+
d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z"
82+
></path>
83+
</svg>
84+
{% endmacro %}

doc/_themes/sphinx13/static/sphinx13.css

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,49 @@ body {
2323
display: flex;
2424
column-gap: 1em;
2525
align-items: center;
26+
justify-content: space-between;
2627
width: 100%;
2728
background-color: var(--colour-sphinx-blue);
2829
padding: 10px 20px;
2930
box-sizing: border-box;
3031
}
3132

32-
.pageheader a {
33+
.pageheader .brand {
34+
display: flex;
35+
align-items: baseline;
36+
column-gap: 1em;
37+
color: white;
38+
text-decoration: none;
39+
}
40+
41+
.pageheader .brand a {
3342
width: 2em;
3443
}
3544

36-
.pageheader img {
45+
.pageheader .brand img {
3746
filter: invert(1) drop-shadow(1px 1px 2px black);
3847
}
3948

40-
.pageheader h1{
49+
.pageheader .brand h1 {
4150
color: white;
4251
margin: 0;
4352
font-weight: 400;
4453
font-size: 2em;
4554
line-height: 1;
4655
}
4756

57+
.pageheader .icons a {
58+
color: white;
59+
}
60+
61+
.pageheader .icons a:hover {
62+
color: rgba(255, 255, 255, 0.8);
63+
}
64+
65+
.pageheader .icons svg {
66+
height: 1.6em;
67+
}
68+
4869
div.document {
4970
display: flex;
5071
margin: 0 0.5em;

0 commit comments

Comments
 (0)