2nd attempt: add plugin to calc SRI hash; add CDN to 'Get Started' page

parent df3e7916
##
# Generate an SRI hash for a given file
require 'digest'
module Jekyll
class GetSriHash < Liquid::Tag
def initialize(tag_name, text, tokens)
super
@filename = text.strip
end
def render(context)
sha256 = Digest::SHA256.file(@filename)
"sha256-#{sha256.base64digest}"
end
end
end
Liquid::Template.register_tag('sri_hash', Jekyll::GetSriHash)
......@@ -69,6 +69,21 @@ relative_path: ../
</div>
</section>
<section class="get-started-CDN margin-top-lg" id="get-started-CDN">
<h2 class="page-header">Using {{ site.forkawesome.name }} with a CDN</h2>
</section>
<div class="row">
<div class="col-md-12">
<p>Thanks to <a href="https://www.jsdelivr.com">jsDelivr</a>, {{ site.forkawesome.name }} is available via a CDN as well.</p>
<p>
{% highlight html %}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fork-awesome@{{ site.forkawesome.version }}/css/fork-awesome.min.css" integrity="{% sri_hash css/fork-awesome.min.css %}" crossorigin="anonymous">
{% endhighlight %}
</p>
</div>
</div>
<section class="get-started-more margin-top-lg" id="get-started-more">
<h2 class="page-header">More Information</h2>
</section>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment