cecil/theme-netlify

Cecil component theme Netlify

Fund package maintenance!
ArnaudLigny
Open Collective

Installs: 19 218

Dependents: 4

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Language:Twig

Type:cecil-theme

2.0.1 2024-03-25 10:42 UTC

This package is auto-updated.

Last update: 2024-03-25 10:42:56 UTC


README

The Netlify component theme for Cecil provides support of Netlify's _redirects and _header.

After installation and without any configuration, this component theme generate:

  1. a _redirects file containing HTML's redirections created by Cecil (automatic or created manually with the redirect front matter variable)
  2. a _header file containg a set of best praticies about security and assets cache control

Installation

composer require cecil/theme-netlify

Or download the latest archive and uncompress its content in themes/netlify.

Usage

Add netlify in the theme section of your config.yml:

theme:
  - netlify

Add redirections

netlify:
  redirects:
    - from: https://xxxxxx/*
      to: https://xxxxxx/:splat
      status: 301 # optional
      force: true # optional

Refer to Netlify documentation for details.

Redirect home page to the user language version

netlify:
  redirect_by_language: true # false by default

It generate the following redirect for each available language (other than the default):

/  /<language-code>/    302!    Language=<language-code>

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).