Settings
Every setting the site reads, its default, and how to change it with Docker and without.
The settings
Every setting is optional: the site runs without any of them.
| Variable | Default | What it does |
|---|---|---|
NEXT_PUBLIC_SITE_URL | http://localhost:3030 | The public address of the site, with https:// and without a slash at the end. The canonical links, the links between the two languages, the sitemap, robots.txt and the social sharing cards are built from it. Set it to your domain before you go live. |
NEXT_PUBLIC_BUY_URL | empty | When set, a strip at the bottom of the footer shows a "Buy This Template" button that opens this address in a new tab. Leave it empty. |
BUILD_STANDALONE | empty | true builds a self-contained server into .next/standalone. The Dockerfile sets it for you. Leave it empty for yarn start. |
Without Docker
Copy .env.example to .env.local and edit the values there. Keep .env.example as it is, as the list of what exists.
Nextjs-landing-page-template-2cp .env.example .env.localNEXT_PUBLIC_SITE_URL=https://www.your-domain.comWith Docker
The image build does not read .env or .env.local files. Pass each value as a build argument instead:
Nextjs-landing-page-template-2docker build -t analytics-landing --build-arg NEXT_PUBLIC_SITE_URL=https://www.your-domain.com .The site inside the container always listens on port 3030. To use another port on your computer, change the number on the left of -p when you start it.
When a change takes effect
Values that start with NEXT_PUBLIC_ are compiled into the JavaScript the browser loads when the site is built. Changing one changes nothing until the site is built again:
| How you run it | After changing a value |
|---|---|
yarn dev | Stop the server and run yarn dev again. |
yarn build and yarn start | Run yarn build again, then yarn start. |
| Docker | Build the image again with the value as a --build-arg, then start a new container. |
| Vercel | Change it in the project's Environment Variables and deploy again. |
Never put a secret in a NEXT_PUBLIC_ value: every visitor can read it in the page's code. Keys for your own services belong on your server.
The standalone build
With BUILD_STANDALONE=true, yarn build writes a server that needs no node_modules into .next/standalone. The Dockerfile uses it to keep the image small. yarn start is not meant for that kind of build and warns "next start" does not work with "output: standalone" configuration. Leave the variable empty unless you copy the standalone folder to a server yourself.