Skip to content

Commit

Permalink
perf: use first letters as favicon (#214)
Browse files Browse the repository at this point in the history
Signed-off-by: msclock <msclock@qq.com>
  • Loading branch information
msclock committed Apr 15, 2024
1 parent 3aa2c83 commit 18d5c03
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]

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

html_css_files = [
"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/fontawesome.min.css",
Expand Down
5 changes: 5 additions & 0 deletions includes/utilities.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[% macro first_letters(string) -%]
[%- set words = string.replace("-", " ").replace(".", " ").split(' ') -%]
[%- set initials = words|map('first')|join() -%]
{{ initials|upper }}
[%- endmacro %]
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[%- from pathjoin("includes", "variable.jinja") import repo_url with context -%]
[%- from pathjoin("includes", "utilities.jinja") import first_letters with context -%]
# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
Expand Down Expand Up @@ -86,7 +87,7 @@ html_theme = "furo"
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ["_static"]

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

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

0 comments on commit 18d5c03

Please sign in to comment.