-
-
Notifications
You must be signed in to change notification settings - Fork 557
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add environment variables to project #1178
base: main
Are you sure you want to change the base?
Conversation
Use value of ELEVENTY_ENV to load analytics and service worker partials if we are anything other than in 'development' mode
Ugh… that merge conflict :/ |
src/_includes/layouts/base.njk
Outdated
@@ -9,8 +12,10 @@ | |||
<link rel="stylesheet" as="style" href="{{ '/css/screen.min.css?v=' + getCurrentVersion.version | url }}" /> | |||
<link rel="alternate" href="{{ metadata.feed.path | url }}" type="application/atom+xml" title="{{ metadata.title }}" /> | |||
<link rel="sitemap" type="application/xml" title="{{ metadata.title }}" href="{{ '/sitemap.xml' | url }}" /> | |||
<link rel="author" href="/humans.txt" /> | |||
{% include "meta/service-worker.njk" %} | |||
<link rel="author" href="humans.txt" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, sorry, I hadn't spied the forward slash when I fixed a conflict.
require('dotenv').config(); | ||
|
||
module.exports = { | ||
environment: process.env.ELEVENTY_ENV || 'development' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would need to be set to something other than 'development' over on Netlify…
@danielmatthew Thanks for the work! I reviewed the code and it works perfectly to include the service worker and the analytics only if the environment variable is not labelled development. I think we can add a bit more things to the envionment variables. For example, a lot of the information in Also, you will need to resolve the merge conflict again. |
A first pass. In #937 I'd seen reference to #966, so in development mode we don't pull in the service worker partial, nor the analytics.
Before:
After:
Closes #937