Skip to content

Commit b23d572

Browse files
Move "generator" in footer
1 parent 180c240 commit b23d572

File tree

5 files changed

+139
-0
lines changed

5 files changed

+139
-0
lines changed

docs/stylesheet/extra.css

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,36 @@
1212
text-align: -webkit-center;
1313
}
1414

15+
/* Allow users to set the "mkdocs-material generator" to right side of footer */
16+
.md-social.generator-right {
17+
display: inline-flex;
18+
gap: .2rem;
19+
margin: 0 .4rem;
20+
padding: .4rem 0 0
21+
}
22+
23+
@media screen and (min-width: 45em) {
24+
.md-social.generator-right {
25+
padding: .2rem 0 0
26+
}
27+
}
28+
29+
.md-copyright.generator-right {
30+
color: var(--md-footer-fg-color--lighter);
31+
font-size: .64rem;
32+
margin: auto .6rem;
33+
padding: 0 0 .6rem;
34+
width: 100%
35+
}
36+
37+
@media screen and (min-width: 45em) {
38+
.md-copyright.generator-right {
39+
padding: 0 0 .2rem;
40+
width:auto
41+
}
42+
}
43+
44+
1545
/* SparkFun dark brand color: #3c464d */
1646

1747
/* Sets the maximum height size of the code blocks */

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ extra:
294294
# Configures the hyperlink for the logo in the header
295295
homepage: https://www.sparkfun.com/pnt
296296

297+
generator: right
298+
297299
# Configures social icons in the footer
298300
social:
299301
- icon: sfe

overrides/partials/copyright.html

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!--
2+
Copyright (c) 2016-2025 Martin Donath <[email protected]>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to
6+
deal in the Software without restriction, including without limitation the
7+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8+
sell copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
IN THE SOFTWARE.
21+
-->
22+
23+
<!-- Copyright and theme information -->
24+
<div class="md-copyright">
25+
{% if config.copyright %}
26+
<div class="md-copyright__highlight">
27+
{{ config.copyright }}
28+
</div>
29+
{% endif %}
30+
{% if not config.extra.generator == false %}
31+
{% if not config.extra.generator == "right" %}
32+
{% include "partials/generator.html" %}
33+
{% endif %}
34+
{% endif %}
35+
</div>

overrides/partials/generator.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Made with
2+
<a
3+
href="https://squidfunk.github.io/mkdocs-material/"
4+
target="_blank" rel="noopener"
5+
>
6+
Material for MkDocs
7+
</a>

overrides/partials/social.html

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<!--
2+
Copyright (c) 2016-2025 Martin Donath <[email protected]>
3+
4+
Permission is hereby granted, free of charge, to any person obtaining a copy
5+
of this software and associated documentation files (the "Software"), to
6+
deal in the Software without restriction, including without limitation the
7+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8+
sell copies of the Software, and to permit persons to whom the Software is
9+
furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in
12+
all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
17+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20+
IN THE SOFTWARE.
21+
-->
22+
23+
<!-- Social links -->
24+
<div>
25+
{% if config.extra.generator == "right" %}
26+
<article class="md-social generator-right">
27+
{% endif %}
28+
{% if not config.extra.generator == "right" %}
29+
<article class="md-social">
30+
{% endif %}
31+
32+
{% for social in config.extra.social %}
33+
34+
<!-- Automatically set rel=me for Mastodon -->
35+
{% set rel = "noopener" %}
36+
{% if "mastodon" in social.icon %}
37+
{% set rel = rel ~ " me" %}
38+
{% endif %}
39+
40+
<!-- Compute title and render link -->
41+
{% set title = social.name %}
42+
{% if not title and "//" in social.link %}
43+
{% set _, url = social.link.split("//") %}
44+
{% set title = url.split("/")[0] %}
45+
{% endif %}
46+
<a
47+
href="{{ social.link }}"
48+
target="_blank" rel="{{ rel }}"
49+
title="{{ title | e }}"
50+
class="md-social__link"
51+
>
52+
{% include ".icons/" ~ social.icon ~ ".svg" %}
53+
</a>
54+
{% endfor %}
55+
</article>
56+
57+
58+
{% if config.extra.generator == "right" %}
59+
<article class="md-copyright generator-right">
60+
{% include "partials/generator.html" %}
61+
</article>
62+
{% endif %}
63+
64+
65+
</div>

0 commit comments

Comments
 (0)