This repository contains a Gatsby website integrated with Contentful for content management and a newly introduced Blog Post system. By leveraging GraphQL queries and Contentfulβs flexible data model, the site can fetch and render content for Pages, Blog Posts, and modular homepage blocks (e.g., Hero, Feature, CTA, etc.).
- Blog Post Content Type: Manage blog articles (title, slug, excerpt, body, image, category, date, etc.) directly from Contentful.
- Modular Homepage Blocks: Use a variety of content types (Hero, Feature, CTA, etc.) for flexible, reusable homepage sections.
- SEO-Friendly: Includes separate fields for SEO Title and SEO Description in both Page and Blog Post content types, plus a custom
<SEOHead>
component for meta tags. - Dynamic Routing: Gatsbyβs
createPages
API ingatsby-node.js
generates individual blog pages and category-based archives automatically. - Responsive, Accessible UI: Styles built with Vanilla Extract for consistent design tokens and fluid responsiveness.
- Postman allows you to quickly test and prototype Contentful API queries without writing code. You can:
- Validate content structure before frontend integration
- Debug or inspect specific entries and assets
- Preview query filters, sorting, and field selections
IN PROGRESS
- Gatsby: React-based static site generator for high performance and speed.
- Contentful: Headless CMS to store and deliver structured content.
- GraphQL: Query language for pulling data from Contentful.
- Vanilla Extract: CSS-in-JS approach for theming and design tokens.
- Netlify: Hosting and continuous deployment (see
netlify.toml
). - Node.js: For local development scripts and Gatsby build process.
Fields:
- Slug (Short text, required)
- Title (Short text, required)
- Body (Rich text)
- Excerpt (Long text)
- Image (File)
- Date (Date & time)
- Category (Short text)
- Author (Reference to an Author or text)
- SEO Title (Short text, < 50 chars)
- SEO Description (Long text)
Note: The
slug
is used to generate the page URL (e.g./blogs/{slug}
). GraphQL queries ingatsby-node.js
orblog-post.js
fetch data for each post.
Fields:
- title (Short text)
- slug (Short text, required)
- description (Short text)
- Image (File)
- Body (Rich text)
- SEO Title (Short text, <35 chars)
- SEO Description (Long text)
Note: Typically used for top-level site pages with custom content.
These content types (e.g., Homepage Hero, Feature List, CTA, LayoutHeader, LayoutFooter, etc.) are stored in Contentful and retrieved for the homepage and global site layout. They share common fields via GraphQL interfaces.
-
Setup
-
Copy
.env.EXAMPLE
β.env.development
&.env.production
, fill in Contentful credentials:CONTENTFUL_SPACE_ID=xxxx CONTENTFUL_ACCESS_TOKEN=xxxx CONTENTFUL_MANAGEMENT_TOKEN=xxxx
-
Install dependencies:
npm install # or yarn install
-
-
Local Development
- Run
npm run develop
oryarn develop
. - Open
http://localhost:8000
to see the site locally. - Use
gatsby-source-contentful
for fetching data. Checkgatsby-config.mjs
for plugin options.
- Run
-
Creating Blog Post Pages
- In
gatsby-node.js
, we query all blog post slugs and create individual pages at build time, using theblog-post.js
template. - For category listings,
blog-category.js
can filter posts by acategory
field.
- In
-
SEO &
<SEOHead>
- Use
src/components/head.js
to inject meta tags on each page or post. - Pass
title
,description
, and optionalimage
orurl
props.
- Use
βββ gah-code-gilbertoharosite/ # Root of the project
βββ README.md # Project readme (this file)
βββ LICENSE # License info (BSD 0-Clause)
βββ gatsby-browser.js # Gatsby browser-level APIs (fonts, global styles)
βββ gatsby-config.mjs # Main Gatsby config, includes plugins
βββ gatsby-node.js # Gatsby Node APIs for dynamic page creation
βββ netlify.toml # Netlify configuration for deployment
βββ package.json # NPM/Yarn dependencies and scripts
βββ .env.EXAMPLE # Example env variables for Contentful
βββ .nvmrc # Node version specification
βββ .prettierignore # Prettier ignore rules
βββ .prettierrc.json # Prettier configuration
βββ src/ # Source code for the Gatsby site
βββ components/ # Reusable and layout components
β βββ fallback.js # Fallback component for unknown block types
β βββ head.js # SEOHead component for meta tags
β βββ sections.js # Exports homepage sections (Hero, CTA, etc.)
β βββ blog/ # Blog post-specific components
β β βββ Card.js
β β βββ PostCard.jsx
β β βββ PostCardSmall.jsx
β βββ design-system/ # Vanilla Extract theming + base styles
β β βββ 404.css.ts
β β βββ about-hero.css.ts
β β βββ colors.css.ts
β β βββ skill.css.ts
β β βββ styles.css.ts
β β βββ theme.css.ts
β βββ layout/ # Layout and navigation structure
β β βββ footer.js # Global footer
β β βββ hero.js # Hero layout section
β β βββ layout.js # Wraps each page with header/footer
β β βββ header/
β β β βββ header.css.ts
β β β βββ header.js
β β βββ navigation/
β β βββ caret.css.ts
β β βββ caret.js
β β βββ nav-item-group.css.ts
β β βββ nav-item-group.js
β βββ ui/ # Generic UI components (buttons, lists, etc.)
β βββ benefit-list.js
β βββ brand-logo.js
β βββ chevron-right.js
β βββ cta.js
β βββ logo-list.js
β βββ product-list.js
β βββ stat-list.js
β βββ ui.css.ts
β βββ ui.jsx
β βββ certifications/
β β βββ resume-styled-cert-list.css.ts
β β βββ resume-styled-cert-list.jsx
β β βββ resume-styled-item.js
β βββ feature/
β β βββ feature-list.jsx
β β βββ feature.jsx
β βββ skills/
β βββ skill-list-grid.js
β βββ styles.css
βββ data/
β βββ certifications.json # Content data for certifications
βββ pages/ # Gatsby pages mapped to routes
β βββ 404.js # Custom 404 page
β βββ experience.js # Experience page
β βββ index.js # Homepage
β βββ learning.js # Learning page
β βββ {Page.slug}.js # Dynamically created pages from Contentful
βββ templates/ # Templates for dynamic page creation
βββ RichTextRenderer.js # Renders rich text fields from Contentful
βββ blog-category.js # Lists posts under specific categories
βββ blog-index.js # Main blog listing or "index" page
βββ blog-post.css.ts # Styling for single blog posts
βββ blog-post.js # Template for rendering individual blog posts
-
Clone & Install
git clone <repo-url> cd gah-code-gilbertoharosite npm install # or yarn install
-
Environment Variables
- Copy
.env.EXAMPLE
β.env.development
/.env.production
- Provide Contentful credentials.
- Copy
-
Develop
npm run develop
or
yarn develop
Go to
http://localhost:8000
. -
Build & Serve
npm run build && npm run serve
or
yarn build && yarn serve
-
Deploy
- Netlify: This project includes
netlify.toml
for config. - Other hosts: Serve the
public/
folder aftergatsby build
.
- Netlify: This project includes
This project is licensed under BSD Zero Clause License (0BSD). See LICENSE for details.
- Audit Dependencies
- Remove unused dependencies in
package.json
. - Update outdated dependencies (
npm outdated
).
- Remove unused dependencies in
- Review Environment Variables
- Ensure
.env.EXAMPLE
reflects all required environment variables. - Add
.env
to.gitignore
to prevent sensitive data leaks.
- Ensure
- Code Cleanup
- Remove unused components and files.
- Delete commented-out or dead code.
- Organize Folder Structure
- Consolidate redundant folders (e.g.,
/post/
and/templates/
). - Consolidate Card with Compound pattern
- ESLint configuration
- Allow single-use props without requiring destructuring,enforce it for multiple uses
- no-unused-modules update
- Consolidate redundant folders (e.g.,
- Image Optimization
- Ensure all images use
gatsby-plugin-image
. - Replace large static images with Contentful-hosted versions.
- Ensure all images use
- Lazy Loading
- Add lazy loading for non-critical components.
- Build Performance
- Add
gatsby-plugin-preload-fonts
. - Optimize
gatsby-plugin-sharp
for images. - Use
gatsby-plugin-webpack-bundle-analyser-v2
to identify large bundles. - Reduce unused JavaScript and defer loading scripts until they are required to decrease bytes consumed by network activity.
- Gatsby API Script Update
- Add
- Contentful Query Optimizations
- Fetch only necessary fields in GraphQL queries.
- Component Refactoring
- Refactor
BlogIndex
Component
- Refactor
- SEO Metadata
- Add
<SEOHead>
for all pages. - Set default fallback metadata in
gatsby-config.mjs
.
- Add
- Accessibility (A11y)
- Test with Lighthouse for accessibility improvements.
- Use semantic HTML (e.g., replace
<div>
with<button>
where appropriate).
- Structured Data
- Add schema markup for blog posts (author, date, category).
- Vanilla Extract Tokens
- Audit unused/redundant style tokens.
- Ensure tokens are consistently used across components.
- Global Stylesheet
- Add a
base.css.ts
for global resets and typography.
- Add a
- [] Code Cleanup
- Dynamic Blog Pages
- Verify blog posts and category pages are generated correctly.
- Add 404 handling for invalid slugs.
- Pagination
- Add pagination for
/blog
and category pages.
- Add pagination for
- Search Functionality
- Implement search or filtering for blog posts.
- Linting & Formatting
- Ensure
.prettierrc.json
and.prettierignore
are properly configured.- Enable ESLint Rules for Unused Imports & Modules
- Add or configure
eslint
for consistent linting base set up.
- Ensure
- TypeScript Migration
- Migrate components to TypeScript.
- Add
gatsby-plugin-typescript
.
- Testing
- Add unit tests for reusable components (e.g.,
PostCard.js
). - Add end-to-end tests using Cypress.
- Add unit tests for reusable components (e.g.,
- Netlify Configuration
- Optimize
netlify.toml
for redirects and caching. - Enable Netlify analytics.
- Optimize
- CI/CD Integration
- Set up GitHub Actions or Netlify hooks for automated deployments.
- Error Tracking
- Integrate Sentry for error reporting and monitoring.
- Contentful Webhooks
- Trigger Gatsby builds on content changes.
- Offline Support
- Add
gatsby-plugin-offline
for PWA capabilities.
- Add
- Dark Mode
- Add dark mode support to Vanilla Extract tokens.
- Analytics
- Add Google Analytics, Plausible, or PostHog for user behavior tracking.
-
Consistency & Theming
- Maintain consistent styling for headings, buttons, and links across all pages.
- Develop a style guide or pattern library to standardize UI elements.
- Check spacing and alignment to keep layouts uniform.
-
Color Scheme Updates
- Conduct a color palette audit to identify areas lacking visual contrast.
- Choose a primary and secondary color that align with branding and improve readability.
- Use accent colors to highlight important CTAs and hover states.
-
Typography & Readability
- Select or refine a font pairing (e.g., header and body fonts) for consistent branding.
- Standardize font sizes/weights for headings, subheadings, and body text to create a clear hierarchy.
- Test line and paragraph spacing to ensure comfortable readability.
-
Button & CTA Design
- Redesign buttons with sufficient padding, distinct hover states, and clear labeling (e.g., "Learn More").
- Implement color, contrast, and whitespace to make buttons stand out.
- Ensure buttons are large enough for mobile tap targets (at least ~44Γ44px).
-
Responsive Layout Adjustments
- Review breakpoints to ensure smooth adaptation to mobile, tablet, and desktop.
- Check for overlapping or truncated text on smaller screens.
- Adjust font sizes and images for mobile to maintain accessibility.
-
Navigation Streamlining
- Simplify main menu items by grouping pages or sections logically.
- Use descriptive labels for navigation links to clearly communicate destinations.
- Consider a sticky or fixed navigation bar for easier access on long pages.
-
Visual Hierarchy & Content Organization
- Add consistent headings and subheadings to guide users through content.
- Leverage whitespace to separate sections and reduce clutter.
- Use consistent styling (backgrounds, dividers) to distinguish content blocks.
-
Incorporate User Feedback
- Monitor analytics and heatmaps to identify areas with high bounce/exit rates.
-
Enhance Interactive Elements
- Add subtle animations or hover effects to highlight clickable elements.
- Ensure forms have clear labeling, user-friendly error messages, and field highlights.
- Provide immediate visual feedback (color change, loading state) on clicks/submissions.
-
Accessibility (A11y)
- Ensure adequate color contrast for text and background (meets WCAG guidelines).
- Provide descriptive alt text for images and clear button/link text for screen readers.
- Verify keyboard accessibility for interactive elements (buttons, forms, modals).
-
Testing & Finalization
- Gather final feedback and make remaining adjustments.
- Monitor analytics post-launch to measure performance and user engagement.