Skip to content

Make icon links and link shortening optional #2109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def update_config(app):
raise ExtensionError(
"`icon_links` must be a list of dictionaries, you provided "
f"type {type(theme_options.get('icon_links'))}."
"If you wish to disable this feature, either do not provide "
"a value (leave undefined), or set to an empty list."
)

# Set the anchor link default to be # if the user hasn't provided their own
Expand Down Expand Up @@ -282,7 +284,9 @@ def setup(app: Sphinx) -> Dict[str, str]:

app.add_html_theme("pydata_sphinx_theme", str(theme_path))

app.add_post_transform(short_link.ShortenLinkTransform)
theme_options = utils.get_theme_options_dict(app)
if theme_options.get("shorten_urls") is True:
app.add_post_transform(short_link.ShortenLinkTransform)

app.connect("builder-inited", translator.setup_translators)
app.connect("builder-inited", update_config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ logo_link =
surface_warnings = True
back_to_top_button = True
search_as_you_type = False
shorten_urls = True

# Template placement in theme layouts
navbar_start = navbar-logo
Expand Down
Loading