Skip to content

Commit cba1529

Browse files
fix: update site URL and base path in configuration and layout files
1 parent 8cd2f9b commit cba1529

6 files changed

Lines changed: 21 additions & 12 deletions

File tree

astro.config.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import sitemap from '@astrojs/sitemap';
77

88
// https://astro.build/config
99
export default defineConfig({
10-
site: 'https://devtools.example.com',
10+
site: 'https://fehmicitiloglu.github.io',
11+
base: '/tools',
1112
output: 'static',
1213
integrations: [react(), mdx(), sitemap()],
1314
vite: {

src/layouts/BaseLayout.astro

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ export interface Props {
1111
1212
const { title, description, jsonLd } = Astro.props;
1313
14+
const base = import.meta.env.BASE_URL;
15+
1416
// AdSense slot ID for the site-wide footer placement.
1517
// Set PUBLIC_ADSENSE_CLIENT (and replace this slot) to enable. Hidden otherwise.
1618
const FOOTER_AD_SLOT = import.meta.env.PUBLIC_ADSENSE_FOOTER_SLOT ?? '';
@@ -24,14 +26,14 @@ const FOOTER_AD_SLOT = import.meta.env.PUBLIC_ADSENSE_FOOTER_SLOT ?? '';
2426
<header class="bg-white dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700">
2527
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
2628
<nav class="flex items-center justify-between">
27-
<a href="/" class="text-2xl font-bold text-blue-600 dark:text-blue-400">
29+
<a href={base} class="text-2xl font-bold text-blue-600 dark:text-blue-400">
2830
DevTools
2931
</a>
3032
<div class="flex gap-6">
31-
<a href="/tools" class="text-gray-600 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400">
33+
<a href={`${base}tools`} class="text-gray-600 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400">
3234
Tools
3335
</a>
34-
<a href="/blog" class="text-gray-600 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400">
36+
<a href={`${base}blog`} class="text-gray-600 dark:text-gray-300 hover:text-blue-600 dark:hover:text-blue-400">
3537
Blog
3638
</a>
3739
</div>

src/layouts/Layout.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ export interface Props {
88
99
const { title = 'Developer Tools', description = 'Free online developer tools and utilities' } = Astro.props;
1010
11+
const base = import.meta.env.BASE_URL;
12+
1113
// Centralized AdSense loader. Gated by env so dev/preview without the key ships zero ad JS.
1214
const adsenseClient = import.meta.env.PUBLIC_ADSENSE_CLIENT;
1315
const adsEnabled = Boolean(adsenseClient);
@@ -18,8 +20,8 @@ const adsEnabled = Boolean(adsenseClient);
1820
<head>
1921
<meta charset="UTF-8" />
2022
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
21-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
22-
<link rel="icon" href="/favicon.ico" />
23+
<link rel="icon" type="image/svg+xml" href={`${base}favicon.svg`} />
24+
<link rel="icon" href={`${base}favicon.ico`} />
2325
<meta name="generator" content={Astro.generator} />
2426
{adsEnabled && (
2527
<>

src/layouts/ToolLayout.astro

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export interface Props {
1313
1414
const { title, description, category, tags = [], relatedTools = [], jsonLd } = Astro.props;
1515
16+
const base = import.meta.env.BASE_URL;
17+
1618
const adInArticleSlot = import.meta.env.PUBLIC_ADSENSE_SLOT_TOOL_INARTICLE;
1719
const adFooterSlot = import.meta.env.PUBLIC_ADSENSE_SLOT_TOOL_FOOTER;
1820
---
@@ -59,7 +61,7 @@ const adFooterSlot = import.meta.env.PUBLIC_ADSENSE_SLOT_TOOL_FOOTER;
5961
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
6062
{relatedTools.map((tool) => (
6163
<a
62-
href={`/tools/${tool}`}
64+
href={`${base}tools/${tool}`}
6365
class="block p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-400 transition-colors"
6466
>
6567
<span class="text-blue-600 dark:text-blue-400 font-medium">{tool}</span>

src/pages/index.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { generateWebsiteJsonLd } from '@lib/json-ld';
66
const tools = await getCollection('tools');
77
const featuredTools = tools.filter(t => t.data.featured).slice(0, 6);
88
9+
const base = import.meta.env.BASE_URL;
910
const siteUrl = Astro.site?.toString().replace(/\/$/, '') || 'https://devtools.example.com';
1011
1112
const jsonLd = generateWebsiteJsonLd({
@@ -31,7 +32,7 @@ const jsonLd = generateWebsiteJsonLd({
3132
</p>
3233
<div class="flex flex-wrap gap-4 justify-center">
3334
<a
34-
href="/tools"
35+
href={`${base}tools`}
3536
class="px-8 py-3 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-colors"
3637
>
3738
Browse All Tools
@@ -77,7 +78,7 @@ const jsonLd = generateWebsiteJsonLd({
7778
Featured Tools
7879
</h2>
7980
<a
80-
href="/tools"
81+
href={`${base}tools`}
8182
class="text-blue-600 dark:text-blue-400 hover:underline font-medium"
8283
>
8384
View All →
@@ -87,7 +88,7 @@ const jsonLd = generateWebsiteJsonLd({
8788
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
8889
{featuredTools.map((tool) => (
8990
<a
90-
href={`/tools/${tool.id}`}
91+
href={`${base}tools/${tool.id}`}
9192
class="group block p-6 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-400 hover:shadow-lg transition-all"
9293
>
9394
<div class="flex items-start gap-4">
@@ -119,7 +120,7 @@ const jsonLd = generateWebsiteJsonLd({
119120
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
120121
{['Encoding', 'Formatting', 'Conversion', 'Generation', 'Security'].map((category) => (
121122
<a
122-
href={`/tools?category=${category.toLowerCase()}`}
123+
href={`${base}tools?category=${category.toLowerCase()}`}
123124
class="p-4 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-400 transition-colors text-center"
124125
>
125126
<span class="font-medium text-gray-900 dark:text-white">{category}</span>

src/pages/tools/index.astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const jsonLd = generateWebsiteJsonLd({
1717
});
1818
1919
const categories = Array.from(new Set(tools.map(t => t.data.category)));
20+
const base = import.meta.env.BASE_URL;
2021
---
2122

2223
<BaseLayout
@@ -48,7 +49,7 @@ const categories = Array.from(new Set(tools.map(t => t.data.category)));
4849
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
4950
{sortedTools.map((tool) => (
5051
<a
51-
href={`/tools/${tool.id}`}
52+
href={`${base}tools/${tool.id}`}
5253
class="group block p-6 bg-white dark:bg-gray-800 rounded-lg border border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-400 hover:shadow-lg transition-all"
5354
>
5455
<div class="flex items-start gap-4">

0 commit comments

Comments
 (0)