Skip to content

Commit

Permalink
Misc updates and prep for portaltech. (#89)
Browse files Browse the repository at this point in the history
* Misc updates and prep for portaltech.

* Misc updates and prep for portaltech.

* Sanitize slug.
  • Loading branch information
sherakama authored Nov 2, 2020
1 parent 3951f96 commit 5c8d979
Show file tree
Hide file tree
Showing 8 changed files with 1,682 additions and 2,450 deletions.
37 changes: 37 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Git normalization
# @see https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Normally these settings would be done with macro attributes for improved
# readability and easier maintenance. However macros can only be defined at the
# repository root directory.
# Define text file attributes.
# - Treat them as text.
# - Ensure no CRLF line-endings, neither on checkout nor on checkin.
# - Detect whitespace errors.
# - Exposed by default in `git diff --color` on the CLI.
# - Validate with `git diff --check`.
# - Deny applying with `git apply --whitespace=error-all`.
# - Fix automatically with `git apply --whitespace=fix`.
# Auto-detect text files, ensure they use LF.
* text=auto eol=lf
*.css text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.html text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2 diff=html
*.js text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.json text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.lock text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.md text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.po text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.script text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.txt text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.xml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
*.yml text eol=lf whitespace=blank-at-eol,-blank-at-eof,-space-before-tab,tab-in-indent,tabwidth=2
# Define binary file attributes.
# - Do not treat them as text.
# - Include binary diff in patches instead of "binary files differ."
*.gif -text diff
*.gz -text diff
*.ico -text diff
*.jpg -text diff
*.png -text diff
*.phar -text diff
*.exe -text diff
*.ttf -text diff
1 change: 1 addition & 0 deletions example.env.development
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
GATSBY_STORYBLOK_ACCESS_TOKEN={REPLACE THIS WITH THE ACCESS TOKEN FOR YOUR SPACE}
SECRET={ANY STRING YOU WANT}
3 changes: 3 additions & 0 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ module.exports = {
options: {
name: `Giving to Stanford`,
start_url: `/`,
include_favicon: false,
crossOrigin: `use-credentials`,
icons: [],
},
},
// this (optional) plugin enables Progressive Web App + Offline functionality
Expand Down
8 changes: 5 additions & 3 deletions gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ exports.createPages = ({ graphql, actions }) => {

const entries = result.data.allStoryblokEntry.edges
entries.forEach((entry, index) => {
let pagePath = entry.node.full_slug == 'home' ? '' : `${entry.node.full_slug}/`
let slug = `${entry.node.full_slug}`
slug = slug.replace(/^\/|\/$/g, '')
let pagePath = entry.node.full_slug == 'home' ? '' : slug + '/'

// Wire up the 404 page by setting the path to just 404 as Gatsby expects it.
if (pagePath.match(/^404/)) {
Expand All @@ -45,9 +47,9 @@ exports.createPages = ({ graphql, actions }) => {
if (pagePath.match(/^403/)) {
pagePath = "403"
}

createPage({
path: `/${pagePath}`,
path: '/' + pagePath,
component: storyblokEntry,
context: {
story: entry.node
Expand Down
File renamed without changes.
15 changes: 14 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ##############################################################################
[build]
publish = "public"
functions = "netlify-functions"
functions = "lambda"

[dev]
publish = "public"
Expand All @@ -15,6 +15,12 @@
for = "/*"
[headers.values]
Basic-Auth = "adapt:letmein2020"
Access-Control-Allow-Origin = "*"
X-Frame-Options = "SAMEORIGIN"
Content-Security-Policy = "form-action https:; frame-src *.stanford.edu *.storyblok.com *.kimbia.com *.stripe.com *.stripe.network"
Referrer-Policy = "origin-when-cross-origin"
Strict-Transport-Security = "max-age=2592000"
Feature-Policy = "vibrate 'none'; geolocation 'none'; midi 'none'; notifications 'none'; push 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; speaker 'none'; vibrate 'none'; fullscreen 'none'"

# PLUGIN A11Y
# https://github.com/netlify-labs/netlify-plugin-a11y#readme
Expand Down Expand Up @@ -54,6 +60,13 @@

# REDIRECTS
# ###############################################################################

# API redirect for lambda functions.
[[redirects]]
from = "/api/*"
to = "/.netlify/functions/:splat"
status = 200

# [[redirects]]
# from = "/test"
# to = "/stories/a-win-win-solution/"
Expand Down
Loading

0 comments on commit 5c8d979

Please sign in to comment.