Skip to content

Privacy plugin: Include preloads in URL replacements #7732

@nejch

Description

@nejch

Context

Follow-up to but slightly different from #7650.

Description

We have some preloads in our child theme for custom fonts defined in our mkdocs_theme.yml. Currently, these are ignored by the replace mechanism in the privacy plugin.

Although this is just an optimization and leaving original links shouldn't be much of an issue in my opinion, some of our users want to get rid of external references altogether when building for offline deployments.

Looking at https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel/preload, preloading local files still seems to be a valid use for this, so it's not entirely irrelevant. The change would be trivial, e.g.:

-                    if rel == "stylesheet" or rel == "icon":
+                    if rel in ("icon", "preload", "stylesheet"):

This is not really important, since preconnect rels are already also ignored, but it's something our users have reported so just wanted to discuss. I'm happy to open a little PR to extend this if you agree!

Related links

Use Cases

Offline builds where the user wants to remove links to external resources or ensure no requests are attempted at all.

Visuals

No response

Before submitting

Metadata

Metadata

Assignees

No one assigned

    Labels

    change requestIssue requests a new feature or improvementresolvedIssue is resolved, yet unreleased if open

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions