zola/test_site/templates/index.html
Skyper d3ab3936de
[WIP] Add support for base64-encoded hash values to 'get_file_hash' (#1339)
* Add support for base64-encoded hash values

The global template function 'get_file_hash' can now return a
base64-encoded hash value when its 'base64' parameter is set to true.

See discussion in #519.

* Fix integrity attribute's value in test site

SRI hash values must be base64-encoded.

* Update documentation about 'get_file_hash'

* Fix 'can_get_hash_for_static_files' unit test
2021-02-20 13:31:37 +01:00

18 lines
667 B
HTML

{% extends 'sample/templates/index.html' %}
{% block content %}
<div class="list-posts">
{% for page in section.pages %}
<article>
<h3 class="post__title"><a href="{{ page.permalink }}">{{ page.title }}</a></h3>
</article>
{% endfor %}
</div>
<!-- Next line is meant to test inner html chars (see https://github.com/getzola/zola/issues/1152) -->
<p> <<< </p>
{% endblock content %}
{% block script %}
<script src="{{ get_url(path="scripts/hello.js") | safe }}"
integrity="sha384-{{ get_file_hash(path="scripts/hello.js", base64=true) | safe }}"></script>
{% endblock script %}