From e21ea49c82f888504ba6144ea76d4bb4182be040 Mon Sep 17 00:00:00 2001 From: Justin Stayton Date: Tue, 24 Nov 2020 07:04:11 -0500 Subject: [PATCH] Add option to redirect with JS instead of --- README.md | 9 +++++++++ src/env.js | 3 +++ src/links.njk | 7 ++++++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 src/env.js diff --git a/README.md b/README.md index 99440f8..62aabef 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,15 @@ _Pro tip_: Bookmark the page to (or wherever), and use the default commit message that's populated. Now show me a link shortener that's easier than that! +### Config + +Environment variables are used to set config options. There is only one at this +point: + +| Variable | Description | Values | Default | +| --------- | ------------------------------------------------------------------ | -------- | ------- | +| `SURI_JS` | Whether to redirect with JavaScript instead of a `` refresh. | `1`, `0` | `0` | + ### Install Manually To install Suri somewhere else, or just on your own machine: diff --git a/src/env.js b/src/env.js new file mode 100644 index 0000000..ef8dcc4 --- /dev/null +++ b/src/env.js @@ -0,0 +1,3 @@ +module.exports = { + js: process.env.SURI_JS === '1', +} diff --git a/src/links.njk b/src/links.njk index 7a84c17..affb2f1 100644 --- a/src/links.njk +++ b/src/links.njk @@ -6,4 +6,9 @@ pagination: permalink: "{{ link }}/" --- - + +{% if env.js -%} + +{% else -%} + +{% endif -%}