https://github.com/cecilapp/theme-netlify
The Netlify component theme for Cecil provides support of Netlify's _redirects and _header.
https://github.com/cecilapp/theme-netlify
cecil cecil-theme-component netlify
Last synced: 5 months ago
JSON representation
The Netlify component theme for Cecil provides support of Netlify's _redirects and _header.
- Host: GitHub
- URL: https://github.com/cecilapp/theme-netlify
- Owner: Cecilapp
- License: mit
- Created: 2020-10-14T23:13:57.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-28T14:25:03.000Z (about 1 year ago)
- Last Synced: 2025-04-10T12:50:06.387Z (about 1 year ago)
- Topics: cecil, cecil-theme-component, netlify
- Language: Twig
- Homepage: https://cecil.app/themes/components/
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Netlify component theme
The _Netlify_ component theme for [Cecil](https://cecil.app) provides support of Netlify's [`_redirects`](https://docs.netlify.com/routing/redirects/) and [`_header`](https://docs.netlify.com/routing/headers/).
After installation and without any configuration, this component theme generate:
1. a [`_redirects`](./layouts/_default/page.netlify_redirects.twig) file containing HTML's redirections created by Cecil (automatic or created manually with the [`redirect`](https://cecil.app/documentation/content/#redirect) front matter variable)
2. a [`_headers`](./layouts/_default/page.netlify_headers.twig) file containing HTTP headers created by Cecil (generated from [`headers' configuration`](https://cecil.app/documentation/configuration/#headers))
## Installation
```bash
composer require cecil/theme-netlify
```
> Or [download the latest archive](https://github.com/Cecilapp/theme-netlify/releases/latest/) and uncompress its content in `themes/netlify`.
## Usage
Add `netlify` in the `theme` section of your site configuration:
```yaml
theme:
- netlify
```
### Add redirections
```yaml
netlify:
redirects:
- from: https://xxxxxx/*
to: https://xxxxxx/:splat
status: 301 # optional
force: true # optional
```
Refer to [Netlify documentation](https://docs.netlify.com/routing/redirects/redirect-options/) for details.
#### Redirect home page to the user language version
```yaml
netlify:
redirect_by_language: true # false by default
```
It generate the following redirect for each available language (other than the default):
```
/ // 302! Language=
```
_Example:_
```
/ /fr/ 302! Language=fr
```
> The language can be specified in the cookie `nf_lang`, so you can override the default behavior with JavaScript (in case of a language dropdown selector for example).
### Add headers
```yaml
server:
headers:
- path: # Relative path, prefixed with a slash. Support "*" wildcard.
headers:
- key:
value: ""
```
Document: .