From cce8157b2d096e2c28a6e041f3c1e2ab0896c310 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Mon, 30 Nov 2015 16:34:23 -0500 Subject: [PATCH 1/4] allow noscript fallback to be disabled --- lib/jekyll-gist/gist_tag.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/jekyll-gist/gist_tag.rb b/lib/jekyll-gist/gist_tag.rb index 3e9b844..86bafac 100644 --- a/lib/jekyll-gist/gist_tag.rb +++ b/lib/jekyll-gist/gist_tag.rb @@ -10,6 +10,7 @@ class GistTag < Liquid::Tag def render(context) @encoding = context.registers[:site].config['encoding'] || 'utf-8' + @settings = context.registers[:site].config['gist'] if tag_contents = determine_arguments(@markup.strip) gist_id, filename = tag_contents[0], tag_contents[1] if context.has_key?(gist_id) @@ -50,6 +51,7 @@ def gist_script_tag(gist_id, filename = nil) end def gist_noscript_tag(gist_id, filename = nil) + return if @settings && @settings["noscript"] == false code = fetch_raw_code(gist_id, filename) if !code.nil? code = code.force_encoding(@encoding) From f6d5e6b3b26f640da00cb0ee04849db6f6f39ab4 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Mon, 30 Nov 2015 17:23:51 -0500 Subject: [PATCH 2/4] document --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 4302e41..d606a7c 100644 --- a/README.md +++ b/README.md @@ -47,6 +47,15 @@ You may optionally specify a `filename` after the `gist_id`: This will produce the correct URL to show just the specified file in your post rather than the entire Gist. +## Disabling `noscript` support + +By default, Jekyll Gist will make an HTTP call per Gist to retrieve the raw content of the Gist. This information is used to propagate `noscript` tags for search engines and browsers without Javascript support. If you'd like to disable this feature, for example, to speed up builds locally, simply add the following to your site's `_config.yml`: + +```yml +gist: + noscript: false +``` + ## Contributing 1. Fork it ( https://github.com/jekyll/jekyll-gist/fork ) From d0230206f28688cffaf8a7e48c17266c766d23f8 Mon Sep 17 00:00:00 2001 From: Ben Balter Date: Mon, 30 Nov 2015 17:26:45 -0500 Subject: [PATCH 3/4] add test --- spec/gist_tag_spec.rb | 29 ++++++++++++++++++++--------- spec/spec_helper.rb | 2 +- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/spec/gist_tag_spec.rb b/spec/gist_tag_spec.rb index e10b177..b9f9bca 100644 --- a/spec/gist_tag_spec.rb +++ b/spec/gist_tag_spec.rb @@ -18,7 +18,7 @@ it "produces the correct script tag" do expect(output).to match(/