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

Add Subresource Integrity (SRI) support #164

Merged
merged 1 commit into from
Jan 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ social-share | If you don't want to show buttons to share a blog post on social
use-site-title | If you want to use the site title rather than page title as HTML document title (ie. browser tab title), use `use-site-title: true`. When set, the document title will take the format `Site Title - Site Description` (eg. `My website - A virtual proof that name is awesome!`). By default, it will use `Page Title` if it exists, or `Site Title` otherwise.
layout | What type of page this is (default is `blog` for blog posts and `page` for other pages. You can use `minimal` if you don't want a header and footer)
js | List of local JavaScript files to include in the page (eg. `/js/mypage.js`)
ext-js | List of external JavaScript files to include in the page (eg. `//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js`)
ext-js | List of external JavaScript files to include in the page (eg. `//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.2/underscore-min.js`). External JavaScript files that support [Subresource Integrity (SRI)](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) can be specified using the `href` and `sri` parameters eg.<br/>`href: "//code.jquery.com/jquery-3.1.1.min.js"`<br/>`sri: "sha256-hVVnYaiADRTO2PzUGmuLJr8BLUSjGIZsDYGmIJLv2b8="`
css | List of local CSS files to include in the page
ex-css | List of external CSS files to include in the page
ext-css | List of external CSS files to include in the page. External CSS files using SRI (see `ext-js` parameter) are also supported.
googlefonts | List of Google fonts to include in the page (eg. `["Monoton", "Lobster"]`)

### Advanced features (including how to use a custom URL address for your site)
Expand Down
7 changes: 7 additions & 0 deletions _includes/ext-css.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if include.css.sri %}
<link href="{{ include.css.href }}" rel="stylesheet" integrity="{{ include.css.sri }}" crossorigin="anonymous">
{% elsif include.css.href %}
<link rel="stylesheet" href="{{ include.css.href }}" />
{% else %}
<link rel="stylesheet" href="{{ include.css }}" />
{% endif %}
7 changes: 7 additions & 0 deletions _includes/ext-js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{% if include.js.sri %}
<script src="{{ include.js.href }}" integrity="{{ include.js.sri }}" crossorigin="anonymous"></script>
{% elsif include.js.href %}
<script src="{{ include.js.href }}"></script>
{% else %}
<script src="{{ include.js }}"></script>
{% endif %}
4 changes: 2 additions & 2 deletions _includes/footer-scripts.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{% if layout.common-ext-js %}
{% for js in layout.common-ext-js %}
<script src="{{ js }}"></script>
{% include ext-js.html js=js %}
{% endfor %}
{% endif %}

{% if page.ext-js %}
{% for js in page.ext-js %}
<script src="{{ js }}"></script>
{% include ext-js.html js=js %}
{% endfor %}
{% endif %}

Expand Down
4 changes: 2 additions & 2 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

{% if layout.common-ext-css %}
{% for css in layout.common-ext-css %}
<link rel="stylesheet" href="{{ css }}" />
{% include ext-css.html css=css %}
{% endfor %}
{% endif %}

Expand All @@ -35,7 +35,7 @@

{% if page.ext-css %}
{% for css in page.ext-css %}
<link rel="stylesheet" href="{{ css }}" />
{% include ext-css.html css=css %}
{% endfor %}
{% endif %}

Expand Down