This is a Next.js portfolio site deployed to GitHub Pages.
-
Clone the repository:
git clone https://github.com/walkertexas-coder/portfolio.git cd portfolio -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
The site is automatically deployed to GitHub Pages when changes are pushed to the main branch. The deployment process is handled by GitHub Actions.
Hosting Infrastructure:
- GitHub Pages: Hosts the static site files from the
gh-pagesbranch - AWS Route 53: Provides DNS management and routes the custom domain to GitHub Pages
To manually deploy the site:
-
Build the site:
npm run build
-
Deploy to GitHub Pages:
npm run deploy
If you encounter 404 errors for JavaScript or CSS files on GitHub Pages, try the following:
-
Check the build output: Make sure the
_nextdirectory is being generated in theoutdirectory.npm run build ls -la ./out/_next/static
-
Run the fix-asset-paths script: This script fixes asset paths in the Next.js static export.
npm run fix-paths
-
Clear GitHub Pages cache: Sometimes GitHub Pages caches old files. You can force a rebuild by pushing an empty commit:
git commit --allow-empty -m "Force rebuild" git push -
Check the basePath and assetPrefix: Make sure these are correctly set in
next.config.js. -
Verify the deployment: Check the GitHub Actions workflow to ensure it completed successfully.
The site uses a custom script (fix-asset-paths.js) to ensure all asset paths are correctly prefixed with the repository name. This script is automatically run during the build process.
If you're still experiencing issues, you can manually check the HTML files in the out directory to ensure they're referencing assets with the correct paths:
grep -r "/_next/" ./outAll asset paths should be prefixed with /portfolio/_next/.
The site uses the following Next.js configuration:
output: 'export': Generates a static exportbasePathandassetPrefix: Set to/portfoliofor GitHub PagestrailingSlash: true: Ensures URLs end with a trailing slash for better compatibility with GitHub Pages
The GitHub Actions workflow:
- Checks out the repository
- Sets up Node.js
- Installs dependencies
- Builds the site
- Verifies the build output
- Deploys to the gh-pages branch
To test the site locally with the GitHub Pages configuration:
-
Build the site:
npm run build
-
Serve the static files:
npx serve -s out
-
Open http://localhost:3000/portfolio/ in your browser.
This project is licensed under the MIT License.