- Notifications
You must be signed in to change notification settings - Fork2
The source code for my personal website
License
eddiesigner/eduardogomez.io
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
The source code for my personal website built withGatsby andGhost as a headless CMS.
Install Gatsby and clone the repository
# Install the Gatsby CLInpm install -g gatsby-cli
# Clone the repositorygit clone https://github.com/eddiesigner/eduardogomez.io.git
Then install dependencies
npm install
Create the file.env.development
in the root directory and paste the following variables:
NODE_ENV=developmentSITEURL=http://localhost:8000GHOST_API_URL=https://gatsby.ghost.ioGHOST_CONTENT_API_KEY=9cc5c67c358edfdd81455149d0GTM_ID=GTM-XXXXXXX
The API URL is the URL of your Ghost site. For Ghost(Pro) customers, this is the Ghost URL ending in.ghost.io
, and for people using the self-hosted version of Ghost, it's the same URL used to access your site.
A Content API Key can be provided by creating an integration within Ghost Admin. Navigate to Integrations and click "Add new integration". Name the integration appropriately and click create.
Start the development server. You now have a Gatsby site pulling content from headless Ghost.
gatsby develop
Finally, configure your desired URL insiteConfig.js
, so links (e. g. canonical links) are generated correctly. You can also update other default values, such aspostsPerPage
in this file.
Create the file.env.production
in the root directory, paste the same development variables and change the values accordingly.
# Run a production build, locallygatsby build# Serve a production build, locallygatsby serve
Gatsbydevelop
uses thedevelopment
variables in.env.development
- while Gatsbybuild
uses theproduction
variables in.env.production
.
The project contains three config files specifically for deploying with Netlify. Anetlify.toml
file for build settings, a/static/_headers
file with default security headers set for all routes, and/static/_redirects
to set Netlify custom domain redirects.
To deploy to your Netlify account, hit the button below.
The environment variables including your Content API Keys must be set asNetlify ENV variables for production builds.
Once deployed, you can set up aGhost + Netlify Integration to use deploy hooks from Ghost to trigger Netlify rebuilds. That way, any time data changes in Ghost, your site will rebuild on Netlify.
You can disable the default Ghost Handlebars Theme front-end by enabling theMake this site private
flag within your Ghost settings. This enables password protection in front of the Ghost install and sets<meta name="robots" content="noindex" />
so your Gatsby front-end becomes the source of truth for SEO.