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 ) 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) diff --git a/spec/gist_tag_spec.rb b/spec/gist_tag_spec.rb index e10b177..392d18a 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(/