Skip to content
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

Make icon links and link shortening optional #2109

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

westurner
Copy link

@westurner westurner commented Jan 27, 2025

Backwards compatible:

Not backwards compatible:

@westurner westurner changed the title Make icon links optional Make icon links and link shortening optional Jan 27, 2025
f"type {type(theme_options.get('icon_links'))}."
)
if theme_options.get("icon_links") is not None:
if not isinstance(theme_options.get("icon_links", []), list):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why on current main, setting icon_links = Nonein yourconf.pywould cause an error here. But if you don't want icon links, why not just leaveicon_links` undefined? Genuinely curious if there's a reason you need this.

},
)
if icon_links is not None:
for url, icon, name in shortcuts:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question as above: the code on main is fine if icon_links is not defined, it only errors if you explicitly set icon_links=None in the html_theme_options dictionary of conf.py. So why do that?

Comment on lines +289 to +290
if theme_options.get("shorten_urls") is True:
app.add_post_transform(short_link.ShortenLinkTransform)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for this change, you'll need to add shorten_urls to src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf and give it a default value (probably True for backwards compatibility)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants