Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions scripts/post-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,31 @@ if (process.env.NODE_ENV === 'production' && process.env.DEPLOY_TARGET === 'gith
// Move logos directory to web-novit/logos
moveDirectory('logos', 'web-novit/logos', '/logos/ → /web-novit/logos/');

// Move video directory to web-novit/video
moveDirectory('video', 'web-novit/video', '/video/ → /web-novit/video/');
// Move root-level assets to web-novit directory
const rootAssets = [
'novit-logo-official.png',
'novit-icon-only.svg',
'favicon.png',
'robots.txt',
'site.webmanifest',
'sitemap.xml'
];

rootAssets.forEach(asset => {
const fromPath = path.join(outDir, asset);
const toPath = path.join(webNovitDir, asset);

if (fs.existsSync(fromPath)) {
try {
fs.copyFileSync(fromPath, toPath);
console.log(`✅ Copied /${asset} → /web-novit/${asset}`);
} catch (error) {
console.log(`⚠️ Failed to copy ${asset}:`, error.message);
}
}
});

// Keep root files at root for GitHub Pages
console.log('✅ Root files maintained for GitHub Pages compatibility');
console.log('✅ Root assets moved to web-novit directory for GitHub Pages compatibility');

console.log('🎉 GitHub Pages structure ready!');
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/academia/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import remarkGfm from 'remark-gfm';
import Image from 'next/image';
import Link from 'next/link';
import { ArrowLeft, BookOpen, Users, Award, Target } from 'lucide-react';
import { getAssetPath } from '@/config/constants';
import { getNavigationPath } from '@/config/constants';
import BackgroundVideo from '@/components/ui/BackgroundVideo';

interface AcademiaFrontmatter {
Expand Down Expand Up @@ -203,7 +203,7 @@ export default async function AcademiaPage({
{/* Back Navigation */}
<div className="mb-8">
<Link
href={getAssetPath(`/${locale}`)}
href={getNavigationPath(`/${locale}`)}
className="inline-flex items-center text-accent-cyan hover:text-accent-cyan/80 transition-colors font-medium"
>
<ArrowLeft className="w-4 h-4 mr-2" />
Expand Down
4 changes: 2 additions & 2 deletions src/app/[locale]/carreras/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import remarkGfm from 'remark-gfm';
import Image from 'next/image';
import Link from 'next/link';
import { ArrowLeft, Briefcase, Users, Star, Target } from 'lucide-react';
import { getAssetPath } from '@/config/constants';
import { getNavigationPath } from '@/config/constants';
import BackgroundVideo from '@/components/ui/BackgroundVideo';

interface CarrerasFrontmatter {
Expand Down Expand Up @@ -203,7 +203,7 @@ export default async function CarrerasPage({
{/* Back Navigation */}
<div className="mb-8">
<Link
href={getAssetPath(`/${locale}`)}
href={getNavigationPath(`/${locale}`)}
className="inline-flex items-center text-accent-cyan hover:text-accent-cyan/80 transition-colors font-medium"
>
<ArrowLeft className="w-4 h-4 mr-2" />
Expand Down
8 changes: 4 additions & 4 deletions src/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ArrowUp,
Check
} from 'lucide-react';
import { getAssetPath } from '@/config/constants';
import { getAssetPath, getNavigationPath } from '@/config/constants';
import { ServiceContent } from '@/lib/contentLoader';

interface FooterProps {
Expand Down Expand Up @@ -176,7 +176,7 @@ export default function Footer({ locale: localeParam, services = [] }: FooterPro
].map((item) => (
<li key={item.key}>
<Link
href={getAssetPath(`/${locale}${item.href}`)}
href={getNavigationPath(`/${locale}${item.href}`)}
className="text-gray-300 hover:text-accent-cyan transition-colors text-sm"
>
{t(`company_links.${item.key}`)}
Expand Down Expand Up @@ -275,13 +275,13 @@ export default function Footer({ locale: localeParam, services = [] }: FooterPro

<div className="flex items-center space-x-6 text-sm text-gray-400">
<Link
href={getAssetPath(`/${locale}/privacy`)}
href={getNavigationPath(`/${locale}/privacy`)}
className="hover:text-accent-cyan transition-colors"
>
{t('privacy_policy')}
</Link>
<Link
href={getAssetPath(`/${locale}/terms`)}
href={getNavigationPath(`/${locale}/terms`)}
className="hover:text-accent-cyan transition-colors"
>
{t('terms_of_use')}
Expand Down
22 changes: 11 additions & 11 deletions src/components/layout/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Image from 'next/image';
import { Menu, X } from 'lucide-react';
import { useLocale } from 'next-intl';

import { getAssetPath } from '@/config/constants';
import { getAssetPath, getNavigationPath } from '@/config/constants';
import PremiumQuoteModal from '@/components/ui/PremiumQuoteModal';
import LanguageSwitcher from '@/components/ui/LanguageSwitcher';
import TransitionLink from '@/components/ui/TransitionLink';
Expand All @@ -28,22 +28,22 @@ export default function Header({ locale: localeParam, navigationContent }: Heade

// Default navigation if no content provided (fallback)
const defaultNavigation = [
{ label: 'Inicio', href: getAssetPath(`/${locale}/#home`), isHome: true },
{ label: 'Qué hacemos', href: getAssetPath(`/${locale}/#services`) },
{ label: 'Casos de Éxito', href: getAssetPath(`/${locale}/#${locale === 'en' ? 'success-stories' : locale === 'pt' ? 'casos-sucesso' : 'casos-exito'}`) },
{ label: 'Academia Novit', href: getAssetPath(`/${locale}/academia`) },
{ label: 'Carreras', href: getAssetPath(`/${locale}/carreras`) },
{ label: 'Inicio', href: getNavigationPath(`/${locale}/#home`), isHome: true },
{ label: 'Qué hacemos', href: getNavigationPath(`/${locale}/#services`) },
{ label: 'Casos de Éxito', href: getNavigationPath(`/${locale}/#${locale === 'en' ? 'success-stories' : locale === 'pt' ? 'casos-sucesso' : 'casos-exito'}`) },
{ label: 'Academia Novit', href: getNavigationPath(`/${locale}/academia`) },
{ label: 'Carreras', href: getNavigationPath(`/${locale}/carreras`) },
];

const navigation = navigationContent ? [
{ label: navigationContent.data.home, href: getAssetPath(`/${locale}/#home`), isHome: true },
{ label: navigationContent.data.services, href: getAssetPath(`/${locale}/#services`) },
{ label: navigationContent.data.home, href: getNavigationPath(`/${locale}/#home`), isHome: true },
{ label: navigationContent.data.services, href: getNavigationPath(`/${locale}/#services`) },
{
label: navigationContent.data.stories,
href: getAssetPath(`/${locale}/#${locale === 'en' ? 'success-stories' : locale === 'pt' ? 'casos-sucesso' : 'casos-exito'}`)
href: getNavigationPath(`/${locale}/#${locale === 'en' ? 'success-stories' : locale === 'pt' ? 'casos-sucesso' : 'casos-exito'}`)
},
{ label: navigationContent.data.academy, href: getAssetPath(`/${locale}/academia`) },
{ label: navigationContent.data.careers, href: getAssetPath(`/${locale}/carreras`) },
{ label: navigationContent.data.academy, href: getNavigationPath(`/${locale}/academia`) },
{ label: navigationContent.data.careers, href: getNavigationPath(`/${locale}/carreras`) },
] : defaultNavigation;

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/components/sections/CasesGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CasesHeaderContent, StoryContent } from '@/lib/contentLoader';

import { ArrowUpRight, Tag } from 'lucide-react';
import { calculateYearsOfExperience } from '@/utils/experience';
import { getAssetPath } from '@/config/constants';
import { getAssetPath, getNavigationPath } from '@/config/constants';
import BackgroundVideo from '@/components/ui/BackgroundVideo';

// Function to convert StoryContent to CaseStudy format
Expand Down Expand Up @@ -138,7 +138,7 @@ function CaseCard({ caseStudy, index, locale: localeParam, headerContent }: {
{/* Action Button */}
<div className="flex justify-end">
<Link
href={getAssetPath(`/${locale}/casos-exito/${caseStudy.id}`)}
href={getNavigationPath(`/${locale}/casos-exito/${caseStudy.id}`)}
className="inline-flex items-center bg-gradient-novit-accent text-white px-6 py-3 rounded-full font-semibold text-sm hover:shadow-lg hover:scale-105 transition-all duration-300"
>
{headerContent?.data.view_case || 'Ver caso completo'}
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/FloatingCTA.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useState } from 'react';
import { MessageCircle, X, Send } from 'lucide-react';
import Link from 'next/link';
import { useTranslations, useLocale } from 'next-intl';
import { getAssetPath } from '@/config/constants';
import { getNavigationPath } from '@/config/constants';

export default function FloatingCTA() {
const [isOpen, setIsOpen] = useState(false);
Expand Down Expand Up @@ -157,7 +157,7 @@ export default function FloatingCTA() {
/>
<label htmlFor="privacy" className="text-sm text-gray-600">
{t('privacy_acceptance')}{' '}
<Link href={getAssetPath(`/${locale}/privacy`)} className="text-accent-cyan hover:underline">
<Link href={getNavigationPath(`/${locale}/privacy`)} className="text-accent-cyan hover:underline">
{t('privacy_policy')}
</Link>{' '}
{t('privacy_text')}
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/HomeLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { ReactNode } from 'react';
import { getAssetPath } from '@/config/constants';
import { getNavigationPath } from '@/config/constants';

interface HomeLinkProps {
locale: string;
Expand All @@ -23,7 +23,7 @@ export default function HomeLink({
const pathname = usePathname();

// Use provided href or generate default one
const homeHref = providedHref || getAssetPath(`/${locale}/#home`);
const homeHref = providedHref || getNavigationPath(`/${locale}/#home`);

const handleClick = (e: React.MouseEvent) => {
// Verificar si ya estamos en la página home
Expand Down
19 changes: 12 additions & 7 deletions src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,24 @@ export function getAssetPath(path: string): string {
return normalizedPath;
}

// Durante build time para GitHub Pages, Next.js maneja automáticamente el basePath
// En el cliente, si ya estamos en GitHub Pages, no necesitamos agregar basePath
// porque Next.js ya lo ha aplicado a las rutas
// Para GitHub Pages, necesitamos agregar el basePath para assets estáticos
// tanto en build time como en runtime
const isGitHub = isOnGitHubPages();

// Si estamos en build de GitHub Pages (server-side) o ya estamos en GitHub Pages (client-side),
// no agregamos basePath porque Next.js ya lo maneja
if (isGitHub) {
return normalizedPath;
return `/web-novit${normalizedPath}`;
}

// Solo para desarrollo local u otros entornos que no sean GitHub Pages
// Para desarrollo local u otros entornos
return normalizedPath;
}

/**
* Get the correct navigation path - should NOT include basePath as Next.js handles this automatically
*/
export function getNavigationPath(path: string): string {
// Las rutas de navegación no necesitan basePath porque Next.js las maneja automáticamente
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
return normalizedPath;
}

Expand Down
Loading