-
Notifications
You must be signed in to change notification settings - Fork 25.4k
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
Allow <head>
and footer scripts to be changed via config
#1241
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d92e273
All `<head>` and footer scripts to be changed via config
mmistakes 56acb7e
Allow `<head>` and footer scripts to be changed via config
mmistakes 55a840a
Merge branch 'custom-scripts' of https://github.com/mmistakes/minimal…
mmistakes 3c3c2f2
Fix typo
mmistakes e1ddd48
Add link to PR
mmistakes c17235c
Fix merge conflicts
mmistakes d8b108f
Update JavaScript documentation
mmistakes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script> | ||
{% if site.footer_scripts %} | ||
{% for script in site.footer_scripts %} | ||
{% if script contains "://" %} | ||
{% capture script_path %}{{ script }}{% endcapture %} | ||
{% else %} | ||
{% capture script_path %}{{ script | absolute_url }}{% endcapture %} | ||
{% endif %} | ||
<script src="{{ script_path }}"></script> | ||
{% endfor %} | ||
{% else %} | ||
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script> | ||
{% endif %} | ||
|
||
{% include analytics.html %} | ||
{% include /comments-providers/scripts.html %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,15 @@ | ||
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script> | ||
{% if site.footer_scripts %} | ||
{% for script in site.footer_scripts %} | ||
{% if script contains "://" %} | ||
{% capture script_path %}{{ script }}{% endcapture %} | ||
{% else %} | ||
{% capture script_path %}{{ script | absolute_url }}{% endcapture %} | ||
{% endif %} | ||
<script src="{{ script_path }}"></script> | ||
{% endfor %} | ||
{% else %} | ||
<script src="{{ '/assets/js/main.min.js' | absolute_url }}"></script> | ||
{% endif %} | ||
|
||
{% include analytics.html %} | ||
{% include /comments-providers/scripts.html %} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just "//" to allow for protocol-relative URLs (below too): https://stackoverflow.com/questions/4831741/can-i-change-all-my-http-links-to-just/27999789
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protocol less URLs are now considered an anti-pattern. It's preferable to use
https
when available.https://www.paulirish.com/2010/the-protocol-relative-url/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, that's exactly what I answered on that very same SO thread :) Just thought you'd might want to support it, but I suppose there's really no need, any CDN today would have HTTPS...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. And I'm not sure if
//
might filter out something it shouldn't be. I doubt anyone would have a path with that, but seems possible.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I had the same concern, theoretically
https://github.com/mmistakes//minimal-mistakes
works too. I think evenhttps://github.com/mmistakes://minimal-mistakes
could work but since Liquid doesn't contain anystartswith
method that I can tell, not much can be done anyway.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Keeping things consistent with the rest of the "external URL" checks in the theme. You may be over thinking things a tad, simple is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overthinking is my middle name 😅