How I built my portfolio with Gatsby and ReactJS
My personal site needs some love for a while now, the last commit on it was on Apr 3, 2016. So I need a new site, and I need it fast, and that's precisely where Gatsby helps me.
What I want
- Blazing fast site
- Easy to publish a blog post with code highlights
- Showcase specific GitHub repos
- Scalable and easy to keep updated
Create a Gatsby site
You only need two commands:
npm install -g gatsby-cli
gatsby new site-name https://github.com/gatsbyjs/gatsby-starter-blog
With Gatsby you can startup a site in no time. Since it has the concept of starters you can pick from hundreds the one that matches your project. In my case it was gatsby-starter-blog.
gatsby-starter-blog
This starter has some important plugins installed, so out of the box, I got:
- Blog post with markdown files
- Offline support
- Progressive Web App ready
- SEO enhancements
- Responsive images
- Google Analytics
- Vertical rhythm typography
- prismjs for code syntax highlight
What I added
- Styled components
- Lazy load image inside markdown files with gatsby-remark-lazy-load and lazines (this is a must for performance).
- Github Repo Showcase with gatsby-source-github-api and this GraphQL Query:
{
search(query: "fmonteslab user:fmontes", type: REPOSITORY, first: 100) {
edges {
node {
... on Repository {
name
url
homepageUrl
description
createdAt
pushedAt
primaryLanguage {
id
name
}
repositoryTopics(first: 100) {
edges {
node {
topic {
name
}
}
}
}
}
}
}
}
}
Deploy to Netlify
Netlify is one of the best (if not the best) place to deploy your Gatsby site. And it is super easy to do, follow this steps.
What I got
Fast site
Gatsby takes care of everything, cache, minification, lazy load your images, etc. I had to do some work to improve SEO, like hit areas and aria-labels in some buttons for better score:
Blog posts easy to publish
I just need to create a markdown file in my /content/blog
folder, commit, push, and Netlify will deploy the site with the new post.
My GitHub repos
When I tag one of my repos with #fmonteslab
, I redeploy my site and will be published.
Scalable
With Gatsby, I can create new pages, pull content from everywhere, and quickly add content and features.
More to come
- SEO work
- Post post and post more
- Connect with Linked In API to create a dynamic resume
- Sky is the limit
Conclusion
I'm very happy with the results of my site. I'll keep it updated and get. Please go and check the code: https://github.com/fmontes/fmontes-gatsby, fork it, use it, build your own.