Visit the site live at www.mreyes.info
The goal was to showcase my photography, share my work and project experiences, and share some information about myself. To meet these goals, I needed the site to be:
- Accessible
- Beautifully responsive
- Easily navigable
- Quickly loaded
- Easy to update content
To meet these goals, I decided to use Gatsby (built on React and GraphQL) to create the site and programmatically add content, Netlify CMS for easy content updates without needing to dive into the code, and deployed the site using Vercel.
Below, you'll find information regarding the project structure and relevant files, followed by a brief walk-through of developing the site.
Top-level overview of the project structure:
.
├── node_modules
├── src
├── components
├── images
├── pages
├── styles
├── .gitignore
├── .prettierrc
├── gatsby-browser.js
├── gatsby-config.js
├── gatsby-node.js
├── gatsby-ssr.js
├── LICENSE
├── package-lock.json
├── package.json
└── README.md
-
/node_modules: This directory contains all of the modules of code that your project depends on (npm packages) are automatically installed. -
/src: Where the magic happens. Here we have the front-end code for the site, with sub-directories:a.
/components: Here we have site-wide components (such as buttons and layouts), along with components used for programmatically creating pages (such as the gallery view or individual photo view).b.
/images: Here we store our images, either ingalleriesor for site-wide use - just make sure to direct to use the right path for site-wide images.Note: This directory is ignored in our version control to avoid uploading large image files to github. Check out
.gitignoreto see what else is not watched by version control.c.
/pages: Components that are created as full pages in our site.index.jsacts as our homepagemreyes.info/, while ourcontact.jscomponent provides ourmreyes.info/contact/page.d.
/styles: Our global styling - mainly used to create responsive breakpoints for our site design and maintain consistent typography site-wide. -
.gitignore: This file tells git which files it should not track / not maintain a version history for. -
.prettierrc: This is a configuration file for Prettier. Prettier is a tool to help keep the formatting of the code consistent. -
gatsby-config.js: This is the main configuration file for a Gatsby site. This is where you can specify information about your site (metadata) like the site title and description, which Gatsby plugins you’d like to include, etc. (Check out the config docs for more detail). -
gatsby-node.js: This is where we programmatically create nodes in graphQL for each album and photos in that album. We also create the nodes for our markdown files here, and configure components to render the related information from template components insrc/components. -
LICENSE: Gatsby is licensed under the MIT license. -
package.json: A manifest file for Node.js projects, which includes things like metadata (the project’s name, author, etc). This manifest is how npm knows which packages to install for your project. -
README.md: The file you're reading right now, hopefully it has been helpful.
-
Fork the repository and set-up locally
Through github, you can fork this repository (repo). Check the github docs on how to clone a repo to your local machine.
Be sure to download and install the dependencies listed in
package.json. Using npm:npm install dependency-name
-
Check out the code locally and add an image directory
For images, you can create an
imagesdirectory in the src folder. Photo albums are generated from agalleriessub-directory of images.mkdir src/images/galleries
You can now add your photo albums to the galleries directory and add images to those albums! Albums will appear according to the name of its directory, and photos will be titled according to their file name.
mkdir src/images/galleries/new-album cd src/images/galleries/new-album touch vacation.jpg barcelona.jpgNavigate into the site's directory and load it up in your browser using
gatsby develop.
-
Open the source code and start editing!
Navigate back to the root directory and start editing!
cd personal-revamp/ gatsby developThe site is now running at
http://localhost:8000!Note: You'll also see a second link:
http://localhost:8000/___graphql. This is a tool you can use to experiment with querying your data. Learn more about using this tool in the Gatsby tutorial.Open the
personal-revampdirectory in your code editor of choice (I use VSCode). Save your changes and observe the hot-reloading in your browser!
Since this was built using Gatsby, check out their wonderful documentation. Their tutorials and recipes were helpful and clear.
For content management, I used Netlify CMS - check out the netlify-CMS docs as well.
I utilized Vercel (formerly Zeit now) to deploy the site - check out their docs here.