From 73039c316ef1ebbf79e32bf475390a8f1f12df57 Mon Sep 17 00:00:00 2001 From: "Helmut K. C. Tessarek" Date: Tue, 27 Feb 2018 21:40:04 -0500 Subject: [PATCH] 2nd attempt: add plugin to calc SRI hash; add CDN to 'Get Started' page --- src/doc/_plugins/sri_hash.rb | 20 ++++++++++++++++++++ src/doc/get-started.html | 15 +++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 src/doc/_plugins/sri_hash.rb diff --git a/src/doc/_plugins/sri_hash.rb b/src/doc/_plugins/sri_hash.rb new file mode 100644 index 000000000..63e0242ad --- /dev/null +++ b/src/doc/_plugins/sri_hash.rb @@ -0,0 +1,20 @@ +## +# 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) diff --git a/src/doc/get-started.html b/src/doc/get-started.html index c2c9437aa..13e552e7c 100644 --- a/src/doc/get-started.html +++ b/src/doc/get-started.html @@ -69,6 +69,21 @@ relative_path: ../ +
+ +
+ +
+
+

Thanks to jsDelivr, {{ site.forkawesome.name }} is available via a CDN as well.

+

+{% highlight html %} + +{% endhighlight %} +

+
+
+