Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 8, 2025

This PR resolves two critical issues that were preventing proper navigation and video loading on the GitHub Pages deployment:

🔗 Navigation 404 Issue

The main navigation was generating malformed URLs with double base path prefixing (e.g., /web-novit/web-novit/es/#home instead of /web-novit/es/#home). This occurred because:

  1. Next.js automatically applies the basePath configuration to all Link components during GitHub Pages builds
  2. Our getAssetPath() function was also adding the base path on the client side, causing duplication
  3. When users clicked "Que Hacemos" → "Inicio", they'd get a 404 because the URL was malformed

Solution: Modified getAssetPath() to detect GitHub Pages deployment using client-side URL detection instead of build-time environment variables, preventing double base path application.

🎥 Video Loading Issue

The hero video in the Academia page wasn't loading on GitHub Pages because the /video/ directory wasn't being moved to the correct location during the post-build process.

Solution: Updated the post-build script to move the video directory to /web-novit/video/ alongside other assets.

🛠️ Technical Changes

  • Fixed client-side base path detection in src/config/constants.ts using URL pathname analysis
  • Enhanced post-build script to include video directory relocation
  • Improved HomeLink component to accept pre-computed hrefs and prevent double processing
  • Code cleanup removed unused imports

✅ Verification

  • ✅ Local builds: URLs correctly use /es/#home format
  • ✅ GitHub Pages builds: URLs correctly use /web-novit/es/#home format
  • ✅ Video assets: Now properly accessible at /web-novit/video/hero-academia.mp4
  • ✅ Navigation flows: "Que Hacemos" → "Inicio" works without 404 errors
  • ✅ Client-side navigation: No more double base path after scrolling to sections

The fixes are minimal and surgical, preserving all existing functionality while resolving the GitHub Pages-specific deployment issues.

Fixes #51.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@RHV044
Copy link
Contributor

RHV044 commented Aug 8, 2025

@copilot creo que el problema es que luego de scrollear a Que Hacemos, la URL de Inicio tiene 2 veces web-novit

image

Co-authored-by: RHV044 <7198182+RHV044@users.noreply.github.com>
Copilot AI changed the title [WIP] Link a Inicio 404 despues de tocar en Que Hacemos Fix GitHub Pages URL navigation and video loading issues Aug 8, 2025
Copilot AI requested a review from RHV044 August 8, 2025 19:55
Co-authored-by: RHV044 <7198182+RHV044@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Aug 8, 2025

@copilot creo que el problema es que luego de scrollear a Que Hacemos, la URL de Inicio tiene 2 veces web-novit

<img width="1957" height="1045" alt="image" src="https://github.com/user-attachments/...

Sí, exactamente! El problema era que la lógica de detección de client-side estaba agregando /web-novit cuando Next.js ya lo había manejado automáticamente. He corregido la función getAssetPath() para detectar cuando estamos en GitHub Pages mediante la URL actual en lugar de variables de entorno, evitando así la duplicación del base path.

La corrección en commit b1c0a07 resuelve específicamente el escenario que mencionaste: después de hacer scroll a "Que Hacemos", el enlace de "Inicio" ahora muestra correctamente /web-novit/en/#home en lugar de /web-novit/web-novit/en/#home.

@RHV044 RHV044 marked this pull request as ready for review August 22, 2025 20:19
@RHV044 RHV044 merged commit 77b5520 into master Aug 22, 2025
1 check failed
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.

Link a Inicio 404 despues de tocar en Que Hacemos

2 participants