Skip to content

Conversation

Twissi
Copy link
Contributor

@Twissi Twissi commented Jul 19, 2025

Code generate with Claude.

Also pushed directly to github-pages branch in this repo to see the deployment working: https://opentechschool.github.io/websitenext/

After merging this we need to:

  • set domain to opentechschool.org in GitHub settings

You can ignore the deploy action/PR preview on this PR since it will be deleted once this PR get's merged.

===============================================

Convert Next.js app to static GitHub Pages deployment

This PR converts the OpenTechSchool website from a dynamic Next.js app to a static site that can be deployed on GitHub Pages, while removing multi-language support to keep only English.

🎯 Key Changes

Static Site Conversion:

  • Converted from dynamic Next.js app to static export with proper GitHub Pages configuration
  • Updated next.config.js with environment-aware basePath for GitHub Pages deployment
  • Fixed Next.js 12 static export process (next build && next export)
  • Removed all getInitialProps and converted to getStaticProps/getStaticPaths

Asset Path Management:

  • Created utils/assetPath.js utility for dynamic asset path handling with basePath support
  • Updated all image references to use assetPath() for GitHub Pages compatibility
  • Fixed hardcoded paths in CityHero backgrounds, team member photos, and meta images
  • Updated font URLs in global CSS to support basePath

Multi-language Removal:

  • Removed German language support and kept only English
  • Deleted German translation files and city data
  • Simplified translation hooks and removed locale switching

Font Loading Optimization:

  • Added font preloading in _document.tsx to fix client-side navigation font issues
  • Implemented environment-aware basePath detection for preload links
  • Resolved FOUT (Flash of Unstyled Text) during client-side routing

Deployment Infrastructure:

  • Replaced Vercel deployment with GitHub Pages workflow
  • Updated GitHub Actions to use latest versions (upload-pages-artifact@v3, deploy-pages@v4)
  • Added .nojekyll file for proper GitHub Pages handling
  • Removed Vercel configuration files

Code Quality:

  • Fixed ESLint configuration for styled-jsx compatibility
  • Updated README with GitHub Pages deployment instructions
  • Removed outdated Slack references and Zeit.co mentions

🔧 Technical Details

  • Next.js 12 Compatibility: Properly configured static export process
  • GitHub Pages Support: Dynamic basePath handling for subdirectory deployment
  • Asset Management: All images, fonts, and static assets use correct paths
  • Performance: Font preloading eliminates client-side navigation issues

🧪 Testing

  • ✅ Static export builds successfully
  • ✅ All asset paths resolve correctly with basePath
  • ✅ Fonts load properly on both direct visits and client-side navigation
  • ✅ GitHub Pages deployment workflow functional

🤖 Generated with https://claude.ai/code

Twissi and others added 15 commits July 19, 2025 15:30
- Remove German language support, keep only English
- Configure Next.js for static export with GitHub Pages basePath support
- Add asset path utility function for proper GitHub Pages URL handling
- Update all hardcoded asset paths to use dynamic basePath
- Fix font URLs to work with GitHub Pages
- Add .nojekyll file to prevent GitHub Pages from ignoring _next files
- Update package.json with export script
- Remove German translation files and city data
- Format code with prettier

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove Vercel-specific GitHub Actions workflow
- Add GitHub Pages deployment workflow with proper Next.js static export
- Configure automatic deployment on push to master/main branches
- Use GitHub's official actions for Pages deployment

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add ignore rules for styled-jsx properties (jsx, global)
- Disable explicit-module-boundary-types warnings
- Fix React version detection in ESLint settings
- Resolves dev server startup issues with linting errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Include github-pages-new branch in GitHub Pages workflow triggers
- Allows testing deployment from feature branch before merging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Update actions/upload-pages-artifact from v2 to v3
- Update actions/deploy-pages from v2 to v4
- Fixes deprecated action version errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Add 'output: export' to next.config.js
- Ensures out/ directory is generated during build
- Fixes GitHub Actions artifact creation error

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove output: 'export' config (Next.js 12 doesn't support it)
- Update export script to run 'next build && next export'
- Convert getInitialProps to getStaticProps/getStaticPaths for cities
- Remove getInitialProps from withLocale container and _document
- Fix data serialization in cities getStaticProps
- Update GitHub Actions workflow to use export command
- Successfully generates static files in out/ directory

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Update all remaining hardcoded asset paths to use assetPath utility for proper GitHub Pages basePath support:
- CityHero component background images
- Meta component favicons and manifest links
- MarkdownTeam component member images
- Cities page social icons and about images

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Update global CSS font declarations to use dynamic basePath for GitHub Pages deployment:
- Add environment detection for GitHub Actions
- Use GITHUB_REPOSITORY to extract repository name for basePath
- Apply basePath to OpenSans, Roboto, and Material Icons font URLs
- Ensures fonts load correctly when deployed with basePath on GitHub Pages

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Replace outdated Zeit.co deployment information
- Add detailed instructions for building with GitHub Pages basePath locally
- Include environment variables needed for proper GitHub Pages build
- Explain difference between local and GitHub Pages builds
- Document asset path behavior with basePath configuration

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove Slack channel mentions from contribution guidelines
- Replace Slack communication with GitHub issue discussions
- Encourage using GitHub issues for help and collaboration
- Simplify communication channels to focus on GitHub-based workflow

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Add font preloading to _document.tsx to ensure fonts are cached during initial page load, preventing FOUT during client-side navigation. The preload links use environment-aware basePath detection for proper GitHub Pages deployment.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@Twissi Twissi changed the title GitHub pages Deploy website using GitHub pages Jul 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant