diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 95ae4520..42b0274e 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -2,65 +2,42 @@ name: Build & Deploy KLZ Cables on: push: - branches: - - main + branches: [main] jobs: deploy: - runs-on: docker + runs-on: self-hosted steps: - - name: Checkout repo - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Install tools + - name: Login registry run: | - apt-get update - apt-get install -y docker.io openssh-client + echo "${{ secrets.REGISTRY_PASS }}" | \ + docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin - - name: Login to registry - env: - REGISTRY_USER: ${{ secrets.REGISTRY_USER }} - REGISTRY_PASS: ${{ secrets.REGISTRY_PASS }} - run: | - echo "$REGISTRY_PASS" | docker login registry.infra.mintel.me -u "$REGISTRY_USER" --password-stdin - - - name: Build and push ARM64 image + - name: Build image run: | docker build \ --pull \ --build-arg NEXT_PUBLIC_UMAMI_WEBSITE_ID=${{ secrets.NEXT_PUBLIC_UMAMI_WEBSITE_ID }} \ --build-arg NEXT_PUBLIC_UMAMI_SCRIPT_URL=${{ secrets.NEXT_PUBLIC_UMAMI_SCRIPT_URL }} \ --build-arg NEXT_PUBLIC_SENTRY_DSN=${{ secrets.SENTRY_DSN }} \ - -t registry.infra.mintel.me/mintel/klz-cables.com:latest \ - . + -t registry.infra.mintel.me/mintel/klz-cables.com:latest . + + - name: Push image + run: | docker push registry.infra.mintel.me/mintel/klz-cables.com:latest - - name: Setup SSH + - name: Deploy run: | mkdir -p ~/.ssh printf "%s\n" "${{ secrets.ALPHA_SSH_KEY }}" > ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 ssh-keyscan -H alpha.mintel.me >> ~/.ssh/known_hosts - - name: Deploy on server - run: | - tar czf - docker-compose.yml varnish 2>/dev/null | \ - ssh -i ~/.ssh/id_ed25519 -o StrictHostKeyChecking=no deploy@alpha.mintel.me ' - set -e - mkdir -p /home/deploy/sites/klz-cables.com/ - tar xzf - -C /home/deploy/sites/klz-cables.com/ - cd /home/deploy/sites/klz-cables.com/ - - cat > .env << EOF - NEXT_PUBLIC_UMAMI_WEBSITE_ID=${{ secrets.NEXT_PUBLIC_UMAMI_WEBSITE_ID }} - NEXT_PUBLIC_UMAMI_SCRIPT_URL=${{ secrets.NEXT_PUBLIC_UMAMI_SCRIPT_URL }} - SENTRY_DSN=${{ secrets.SENTRY_DSN }} - REDIS_URL=${{ secrets.REDIS_URL }} - REDIS_KEY_PREFIX=${{ secrets.REDIS_KEY_PREFIX }} - EOF - - echo "${{ secrets.REGISTRY_PASS }}" | docker login registry.infra.mintel.me -u "${{ secrets.REGISTRY_USER }}" --password-stdin + ssh deploy@alpha.mintel.me ' docker pull registry.infra.mintel.me/mintel/klz-cables.com:latest - docker compose up -d --force-recreate --remove-orphans - ' + cd /home/deploy/sites/klz-cables.com + docker compose up -d --force-recreate + ' \ No newline at end of file diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 8852ad2f..6732c1e7 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -1,5 +1,6 @@ import Footer from '@/components/Footer'; import Header from '@/components/Header'; +import JsonLd from '@/components/JsonLd'; import AnalyticsProvider from '@/components/analytics/AnalyticsProvider'; import { Viewport } from 'next'; import { NextIntlClientProvider } from 'next-intl'; @@ -31,6 +32,7 @@ export default async function LocaleLayout({ +
{children} diff --git a/app/robots.ts b/app/robots.ts index a1faa92f..7f37f0fc 100644 --- a/app/robots.ts +++ b/app/robots.ts @@ -2,11 +2,17 @@ import { MetadataRoute } from 'next'; export default function robots(): MetadataRoute.Robots { return { - rules: { - userAgent: '*', - allow: '/', - disallow: ['/api/', '/health/'], - }, + rules: [ + { + userAgent: '*', + allow: '/', + disallow: ['/api/', '/health/'], + }, + { + userAgent: ['GPTBot', 'ClaudeBot', 'PerplexityBot', 'Google-Extended', 'OAI-SearchBot'], + allow: '/', + } + ], sitemap: 'https://klz-cables.com/sitemap.xml', }; } diff --git a/components/JsonLd.tsx b/components/JsonLd.tsx index 0565cb51..90a66770 100644 --- a/components/JsonLd.tsx +++ b/components/JsonLd.tsx @@ -1,16 +1,44 @@ -import Script from 'next/script'; +import { Organization, WebSite, WithContext } from 'schema-dts'; -interface JsonLdProps { - id?: string; - data: any; -} +export default function JsonLd() { + const organizationJsonLd: WithContext = { + '@context': 'https://schema.org', + '@type': 'Organization', + name: 'KLZ Cables', + url: 'https://klz-cables.com', + logo: 'https://klz-cables.com/logo-blue.svg', + sameAs: [ + 'https://www.linkedin.com/company/klz-cables', + ], + description: 'Premium Cable Solutions for Renewable Energy and Infrastructure.', + address: { + '@type': 'PostalAddress', + addressCountry: 'DE', + }, + }; + + const websiteJsonLd: WithContext = { + '@context': 'https://schema.org', + '@type': 'WebSite', + name: 'KLZ Cables', + url: 'https://klz-cables.com', + potentialAction: { + '@type': 'SearchAction', + target: { + '@type': 'EntryPoint', + urlTemplate: 'https://klz-cables.com/search?q={search_term_string}', + }, + // @ts-ignore - schema-dts might not have this specific property but it's valid for Google + 'query-input': 'required name=search_term_string', + } as any, + }; -export default function JsonLd({ id, data }: JsonLdProps) { return ( -