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

Fix preconnect config for vendors with custom cdn #506

Merged
merged 3 commits into from
Apr 29, 2022
Merged

Fix preconnect config for vendors with custom cdn #506

merged 3 commits into from
Apr 29, 2022

Conversation

leirock
Copy link
Contributor

@leirock leirock commented Apr 28, 2022

PR Checklist

  • The commit message follows guidelines for NexT.
  • Tests for the changes was maked (for bug fixes / features).
    • Muse | Mist have been tested.
    • Pisces | Gemini have been tested.
  • Docs in NexT website have been added / updated (for features).

PR Type

  • Bugfix.
  • Feature.
  • Code style update (formatting, local variables).
  • Refactoring (no functional changes, no api changes).
  • Documentation.
  • Translation.
  • Other... Please describe:

What is the current behavior?

If we set venders.custom_cdn_url: https://lib.baomitu.com/${cdnjs_name}/${version}/${cdnjs_file}, the preconnect in head will be <link rel="preconnect" href="lib.baomitu.com" crossorigin="">

And in Safari, the console shows Successfully preconnected to https://pinlyu.com/lib.baomitu.com

See: https://pinlyu.com

What is the new behavior?

  • For HTTPS CDN

If we set venders.custom_cdn_url: https://lib.baomitu.com/${cdnjs_name}/${version}/${cdnjs_file}, the preconnect in head will be <link rel="preconnect" href="https://lib.baomitu.com" crossorigin="">

And in Safari, the console will show Successfully preconnected to https://lib.baomitu.com/

  • For HTTP CDN

If we set venders.custom_cdn_url: http://lib.baomitu.com/${cdnjs_name}/${version}/${cdnjs_file}, the preconnect in head will be <link rel="preconnect" href="http://lib.baomitu.com" crossorigin="">

And in Safari, the console will show Successfully preconnected to http://lib.baomitu.com/

@coveralls
Copy link

coveralls commented Apr 28, 2022

Pull Request Test Coverage Report for Build 2242555929

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.468%

Totals Coverage Status
Change from base Build 2216190865: 0.0%
Covered Lines: 138
Relevant Lines: 141

💛 - Coveralls

@njzjz njzjz added this to the 8.11.1 milestone Apr 28, 2022
@stevenjoezhang
Copy link
Member

stevenjoezhang commented Apr 28, 2022

Does Line 61

local   : parse(this.theme.js || '').hostname,

need to be updated?

See also #439

CC @ljcbaby

@leirock
Copy link
Contributor Author

leirock commented Apr 28, 2022

Yep, seems Line 61 also needs to be updated.

@ljcbaby
Copy link
Member

ljcbaby commented Apr 28, 2022

@stevenjoezhang I see my html before, it may generated fine. https://github.com/ljcbaby/ljcbaby.github.io/blob/master/index.html#L947-L950

Forget it, I seems to be not awake now, and see the wrong place.

@stevenjoezhang stevenjoezhang merged commit 46f6efc into next-theme:master Apr 29, 2022
@stevenjoezhang stevenjoezhang changed the title Fix preconnect config for venders with custom cdn Fix preconnect config for vendors with custom cdn Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants