Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jekyll-netlify-headers

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jekyll-netlify-headers

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

jekyll-netlify-headers

A Ruby gem for generating a Netlify headers configuration from a Jekyll configuration.

Gem Downloads Dependencies

Netlify's HTTP headers configuration is quite powerful. Netlify provides two options for configuring your Netlify-deployed website's rules: either in a netlify.toml file or in a _headers file.

Both file formats are perfectly serviceable, but if you're anything like me, you prefer fewer configuration files cluttering up your project. jekyll-netlify-headers allows you to configure your Netlify-deployed website's HTTP headers configuration using your project's existing Jekyll configuration file.

Getting Started

Before installing and using jekyll-netlify-headers, you'll want to familiarize yourself with Jekyll (a fabulous static site generator written in Ruby) and Netlify (a fabulous website hosting service). In particular, you'll want to read up on Netlify's Headers and Basic Authentication documentation.

Installation

If you're using Bundler, add jekyll-netlify-headers to your project's Gemfile:

source 'https://rubygems.org'

group :jekyll_plugins do
  gem 'jekyll-netlify-headers'
end

…and hop over to your command prompt and run…

$ bundle install

Usage

With jekyll-netlify-headers added to your project's Gemfile and installed, add the following to your Jekyll configuration file (typically _config.yml):

netlify:
  headers:
    - paths:
        - /templates/index.html
      headers:
        - "X-Frame-Options: DENY"
        - "X-XSS-Protection: 1; mode=block"
    - paths:
        - /templates/index2.html
        - /templates/index3.html
      headers:
        - "X-Frame-Options: SAMEORIGIN"

Note: Netlify supports a variety of HTTP header configuration options, so comb through their Headers and Basic Authentication documentation for more on the syntax. You may also want to test your HTTP header configuration at Netlify's Playground.

With this configuration added to _config.yml (or to your custom Jekyll configuration file), Jekyll will generate a properly-formatted _headers file in the destination directory when building your project.

The example above will yield a _headers file that looks like:

/templates/index.html
  X-Frame-Options: DENY
  X-XSS-Protection: 1; mode=block
/templates/index2.html
  X-Frame-Options: SAMEORIGIN
/templates/index3.html
  X-Frame-Options: SAMEORIGIN

Improving jekyll-netlify-headers

Want to help make jekyll-netlify-headers better? Hell yeah! I like your enthusiasm. For more on how you can help, check out CONTRIBUTING.md.

Donations

If diving into Ruby isn't your thing, but you'd still like to support jekyll-netlify-headers, consider making a donation! Any amount—large or small—is greatly appreciated. As a token of my gratitude, I'll add your name to the Acknowledgments below.

Donate via Square Cash Donate via Paypal

Acknowledgments

jekyll-netlify-headers wouldn't exist without the hard work of all the folks involved in designing, building, and maintaining Jekyll and Netlify. High fives, y'all. 🙌🏻

jekyll-netlify-headers is written and maintained by Jason Garber.

License

jekyll-netlify-headers is freely available under the MIT License. Use it, learn from it, fork it, improve it, change it, tailor it to your needs.

FAQs

Package last updated on 20 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc