Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added config option to turn off caching.
  • Loading branch information
ianjevans committed Mar 17, 2021
commit d8389f1ff03df469b0b9c5657095f97c10c4c64c
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ remote_include:
on_token_error: full
```

### Caching

By default caching is enabled to improve performance. Disable caching by setting the `use_cache` configuration option to `false`.

```yaml
remote_include:
use_cache: false
```

## Contributing

1. Fork it.
Expand Down
7 changes: 5 additions & 2 deletions lib/jekyll-remote-include.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ def config
end

def open(url)
cache.getset(url) do
if config["use_cache"] == true || !config["use_cache"]
cache.getset(url) do
Net::HTTP.get(URI.parse(url.strip)).force_encoding 'utf-8'
end
else
Net::HTTP.get(URI.parse(url.strip)).force_encoding 'utf-8'
end
end

def render(context)
Expand Down