Skip to content

Commit 18d5c03

Browse files
authored
perf: use first letters as favicon (#214)
Signed-off-by: msclock <msclock@qq.com>
1 parent 3aa2c83 commit 18d5c03

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
# so a file named "default.css" will overwrite the builtin "default.css".
8484
# html_static_path = ["_static"]
8585

86-
html_favicon = 'https://img.shields.io/badge/SS-blue'
86+
html_favicon = 'https://img.shields.io/badge/SSC-blue'
8787

8888
html_css_files = [
8989
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/fontawesome.min.css",

includes/utilities.jinja

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[% macro first_letters(string) -%]
2+
[%- set words = string.replace("-", " ").replace(".", " ").split(' ') -%]
3+
[%- set initials = words|map('first')|join() -%]
4+
{{ initials|upper }}
5+
[%- endmacro %]

template/[% if docs_type == 'sphinx' %]docs[% endif %]/conf.py.jinja

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
[%- from pathjoin("includes", "variable.jinja") import repo_url with context -%]
2+
[%- from pathjoin("includes", "utilities.jinja") import first_letters with context -%]
23
# Configuration file for the Sphinx documentation builder.
34
#
45
# This file only contains a selection of the most common options. For a full
@@ -86,7 +87,7 @@ html_theme = "furo"
8687
# so a file named "default.css" will overwrite the builtin "default.css".
8788
# html_static_path = ["_static"]
8889

89-
html_favicon = 'https://img.shields.io/badge/SS-blue'
90+
html_favicon = 'https://img.shields.io/badge/{{ first_letters(project_name) }}-blue'
9091

9192
html_css_files = [
9293
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/fontawesome.min.css",

0 commit comments

Comments
 (0)