This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchData = async (url) => { | |
try { | |
const response = await fetch(url); | |
const data = await response.json(); | |
return data; | |
} catch(error) { | |
// Handle errors as needed | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetchData = async (url) => { | |
try { | |
const response = await fetch(url); | |
const data = await response.json(); | |
return data; | |
} catch(error) { | |
// Handle errors as needed | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Redirect default Netlify subdomain to primary domain | |
https://yoursubdomain.netlify.com/* https://www.yourcustomdomain.com/:splat 301! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.createPages = ({ actions }) => { | |
const { createRedirect } = actions; | |
createRedirect({ | |
fromPath: "https://yoursubdomain.netlify.com/*", | |
toPath: "https://www.yourcustomdomain.com/:splat", | |
isPermanent: true, | |
force: true | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener('fetch', function(event) { | |
var requestURL = new URL(event.request.url); | |
if (/^\/post\//.test(requestURL.pathname)) { | |
event.respondWith( | |
Promise.all([ | |
caches.match('/post/', {ignoreSearch: true}).then(function(response) { | |
return response.text(); | |
}), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
importScripts('./js/handlebars.min.js'); | |
importScripts('./templates/post.precompiled.js'); | |
var CACHE_NAME = 'cache-v1'; | |
var urlsToCache = [ | |
'/', | |
'/templates/index.precompiled.js', | |
'/post/', | |
'/templates/post.precompiled.js', | |
'/css/style.css', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
const IndexPage = () => { | |
return <h1>Hi there</h1> | |
} | |
export default IndexPage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
... | |
}, | |
plugins: [ | |
`gatsby-plugin-react-helmet`, | |
{ | |
resolve: `gatsby-source-filesystem`, | |
options: { | |
name: `images`, | |
path: `${__dirname}/src/images`, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import styled from "styled-components" | |
import GlobalStyle from "./globalStyle" | |
import Header from "./header" | |
import Footer from "./footer" | |
const StyledLayout = styled.div` | |
width: 100%; | |
min-height: 100vh; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import Layout from "../components/layout" | |
const IndexPage = () => { | |
return ( | |
<Layout> | |
I am a good-looking page, right? | |
</Layout> | |
) |
OlderNewer