Skip to content

Conversation

@aleclarson
Copy link

Description

Make the preloadVisibleLinks and preloadLinksOnAttention methods check the data-swup-no-preload attribute. If it exists, skip preloading for that link.

Checks

  • The PR is submitted to the main branch
  • The code was linted before pushing (npm run lint)
  • All tests are passing (npm run test)
  • New or updated tests are included
  • The documentation was updated as required

Additional information

@hirasso
Copy link
Member

hirasso commented Jul 22, 2025

Hi @aleclarson ,

Thank you for your contribution!

Out of interest: what's your use case for not wanting a page to be preloaded, at all?

Would you mind also creating a section in the readme for the attribute [data-swup-no-preload]?

@aleclarson
Copy link
Author

Out of interest: what's your use case for not wanting a page to be preloaded, at all?

They are server-rendered pages that may often be "passed over" with the mouse, but don't get clicked as often, so I'd prefer to avoid hitting the database for them unless needed.

Would you mind also creating a section in the readme for the attribute [data-swup-no-preload]?

Yup will do

@daun
Copy link
Member

daun commented Aug 4, 2025

@aleclarson Looks useful to me! Is there a reason you switched around the order of the checks? If you get around to adding a super short readme section, we'd be happy to merge this.

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.

3 participants