Skip to content

Commit 816fc79

Browse files
author
mcarbonell
committed
feat: sistema unificado con fasttools-data.json - categoría SEO visible en home
1 parent 98271c1 commit 816fc79

File tree

82 files changed

+241
-239
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+241
-239
lines changed

generate-site.js

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ async function generateIndex(toolsIndex, lang) {
138138

139139
let categoryLinks = '';
140140
categories.forEach(cat => {
141-
categoryLinks += `<a href="${cat.slug[lang]}.html" class="btn btn-outline-primary btn-sm">${cat.icon} ${cat.name[lang]}</a>\n `;
141+
const catSlug = typeof cat.slug === 'string' ? cat.slug : cat.slug[lang];
142+
categoryLinks += `<a href="${catSlug}.html" class="btn btn-outline-primary btn-sm">${cat.icon} ${cat.name[lang]}</a>\n `;
142143
});
143144

144145
// Group tools by category (use translated tools)
@@ -298,17 +299,14 @@ async function generateTools(toolsIndex, lang) {
298299
const baseTemplate = await fs.readFile(baseTemplatePath, 'utf8');
299300
const translations = await loadTranslations(lang);
300301

301-
// Load audience mapping
302-
const audienceMappingPath = path.join(dataDir, 'audience-mapping.json');
303-
const audienceMapping = JSON.parse(await fs.readFile(audienceMappingPath, 'utf8'));
304-
305302
// Load audiences from fasttools-data.json
306303
const fasttoolsData = JSON.parse(await fs.readFile(toolsIndexPath, 'utf8'));
307304
const categories = fasttoolsData.audiences.map(aud => ({
308305
id: aud.id,
309306
slug: aud.slug,
310307
icon: aud.icon,
311-
name: aud.name
308+
name: aud.name,
309+
tools: aud.tools
312310
}));
313311

314312
for (const tool of toolsIndex) {
@@ -355,9 +353,9 @@ async function generateTools(toolsIndex, lang) {
355353
// Generate category badges
356354
let categoryBadges = '';
357355
const toolCategories = [];
358-
for (const [catId, toolIds] of Object.entries(audienceMapping)) {
359-
if (toolIds.includes(tool.id)) {
360-
toolCategories.push(catId);
356+
for (const cat of categories) {
357+
if (cat.tools.includes(tool.id)) {
358+
toolCategories.push(cat.id);
361359
}
362360
}
363361

@@ -367,7 +365,8 @@ async function generateTools(toolsIndex, lang) {
367365
toolCategories.forEach((catId, index) => {
368366
const cat = categories.find(c => c.id === catId);
369367
if (cat) {
370-
const catUrl = lang === siteConfig.defaultLanguage ? `/${cat.slug[lang]}.html` : `/${lang}/${cat.slug[lang]}.html`;
368+
const catSlug = typeof cat.slug === 'string' ? cat.slug : cat.slug[lang];
369+
const catUrl = lang === siteConfig.defaultLanguage ? `/${catSlug}.html` : `/${lang}/${catSlug}.html`;
371370
categoryBadges += `<a href="${catUrl}" class="badge bg-primary text-decoration-none">${cat.icon} ${cat.name[lang]}</a>`;
372371
if (index < toolCategories.length - 1) categoryBadges += ' ';
373372
}
@@ -387,7 +386,8 @@ async function generateTools(toolsIndex, lang) {
387386
toolCategories.forEach((catId, index) => {
388387
const cat = categories.find(c => c.id === catId);
389388
if (cat) {
390-
const catUrl = lang === siteConfig.defaultLanguage ? `https://${siteConfig.domain}/${cat.slug[lang]}.html` : `https://${siteConfig.domain}/${lang}/${cat.slug[lang]}.html`;
389+
const catSlug = typeof cat.slug === 'string' ? cat.slug : cat.slug[lang];
390+
const catUrl = lang === siteConfig.defaultLanguage ? `https://${siteConfig.domain}/${catSlug}.html` : `https://${siteConfig.domain}/${lang}/${catSlug}.html`;
391391
breadcrumbItems.push({
392392
"@type": "ListItem",
393393
"position": index + 2,
@@ -467,9 +467,10 @@ async function generateSitemap(toolsIndex) {
467467

468468
categories.forEach(cat => {
469469
siteConfig.languages.forEach(lang => {
470+
const catSlug = typeof cat.slug === 'string' ? cat.slug : cat.slug[lang];
470471
const url = lang === siteConfig.defaultLanguage
471-
? `${baseUrl}/${cat.slug[lang]}.html`
472-
: `${baseUrl}/${lang}/${cat.slug[lang]}.html`;
472+
? `${baseUrl}/${catSlug}.html`
473+
: `${baseUrl}/${lang}/${catSlug}.html`;
473474

474475
xml += ` <url>\n`;
475476
xml += ` <loc>${url}</loc>\n`;
@@ -479,9 +480,10 @@ async function generateSitemap(toolsIndex) {
479480

480481
// Add xhtml:link for alternate languages
481482
siteConfig.languages.forEach(altLang => {
483+
const altCatSlug = typeof cat.slug === 'string' ? cat.slug : cat.slug[altLang];
482484
const altUrl = altLang === siteConfig.defaultLanguage
483-
? `${baseUrl}/${cat.slug[altLang]}.html`
484-
: `${baseUrl}/${altLang}/${cat.slug[altLang]}.html`;
485+
? `${baseUrl}/${altCatSlug}.html`
486+
: `${baseUrl}/${altLang}/${altCatSlug}.html`;
485487
xml += ` <xhtml:link rel="alternate" hreflang="${altLang}" href="${altUrl}"/>\n`;
486488
});
487489

web/base64.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Developers",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/developers.html"
4444
},
4545
{
4646
"@type": "ListItem",
@@ -76,7 +76,7 @@
7676
<div class="tool-header">
7777
<h1>Encode/Decode Base64</h1>
7878
<p class="text-muted">Encode and decode text in Base64.</p>
79-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">💻 Developers</a></small></div>
79+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/developers.html" class="badge bg-primary text-decoration-none">💻 Developers</a></small></div>
8080
</div>
8181

8282
<div class="mb-3">

web/broken-links-checker.html

-12 Bytes
Binary file not shown.

web/chat-ai.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,19 +40,19 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Writers",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/writers.html"
4444
},
4545
{
4646
"@type": "ListItem",
4747
"position": 3,
4848
"name": "Marketers",
49-
"item": "https://fasttools.tools/undefined.html"
49+
"item": "https://fasttools.tools/marketers.html"
5050
},
5151
{
5252
"@type": "ListItem",
5353
"position": 4,
5454
"name": "AI Tools",
55-
"item": "https://fasttools.tools/undefined.html"
55+
"item": "https://fasttools.tools/ai.html"
5656
},
5757
{
5858
"@type": "ListItem",
@@ -100,7 +100,7 @@
100100
<div class="tool-header">
101101
<h1>AI Chat</h1>
102102
<p class="text-muted">Chat with AI using Google Gemini.</p>
103-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">✍️ Writers</a> <a href="/undefined.html" class="badge bg-primary text-decoration-none">📱 Marketers</a> <a href="/undefined.html" class="badge bg-primary text-decoration-none">🤖 AI Tools</a></small></div>
103+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/writers.html" class="badge bg-primary text-decoration-none">✍️ Writers</a> <a href="/marketers.html" class="badge bg-primary text-decoration-none">📱 Marketers</a> <a href="/ai.html" class="badge bg-primary text-decoration-none">🤖 AI Tools</a></small></div>
104104
</div>
105105

106106
<div id="apiKeySetup" class="api-key-setup">

web/chat-pdf.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "AI Tools",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/ai.html"
4444
},
4545
{
4646
"@type": "ListItem",
@@ -83,7 +83,7 @@
8383
<div class="tool-header">
8484
<h1>Chat with PDF</h1>
8585
<p class="text-muted">Chat with your PDF documents using AI.</p>
86-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">🤖 AI Tools</a></small></div>
86+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/ai.html" class="badge bg-primary text-decoration-none">🤖 AI Tools</a></small></div>
8787
</div>
8888

8989
<div id="apiKeySetup" class="alert alert-warning">

web/color-palette-generator.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Designers",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/designers.html"
4444
},
4545
{
4646
"@type": "ListItem",
4747
"position": 3,
4848
"name": "Marketers",
49-
"item": "https://fasttools.tools/undefined.html"
49+
"item": "https://fasttools.tools/marketers.html"
5050
},
5151
{
5252
"@type": "ListItem",
@@ -82,7 +82,7 @@
8282
<div class="tool-header">
8383
<h1>Color Palette Generator</h1>
8484
<p class="text-muted">Extract dominant color palette from any image.</p>
85-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">🎨 Designers</a> <a href="/undefined.html" class="badge bg-primary text-decoration-none">📱 Marketers</a></small></div>
85+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/designers.html" class="badge bg-primary text-decoration-none">🎨 Designers</a> <a href="/marketers.html" class="badge bg-primary text-decoration-none">📱 Marketers</a></small></div>
8686
</div>
8787

8888
<div class="mb-3">

web/color-picker-converter.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Designers",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/designers.html"
4444
},
4545
{
4646
"@type": "ListItem",
@@ -76,7 +76,7 @@
7676
<div class="tool-header">
7777
<h1>Color Picker & Converter</h1>
7878
<p class="text-muted">Color picker and converter between HEX, RGB and HSL.</p>
79-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">🎨 Designers</a></small></div>
79+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/designers.html" class="badge bg-primary text-decoration-none">🎨 Designers</a></small></div>
8080
</div>
8181

8282
<div class="row g-3 mb-4">

web/compress-pdf.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Productivity",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/productivity.html"
4444
},
4545
{
4646
"@type": "ListItem",
@@ -76,7 +76,7 @@
7676
<div class="tool-header">
7777
<h1>Compress PDF</h1>
7878
<p class="text-muted">Reduce PDF size by compressing images.</p>
79-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">⚡ Productivity</a></small></div>
79+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/productivity.html" class="badge bg-primary text-decoration-none">⚡ Productivity</a></small></div>
8080
</div>
8181

8282
<div class="mb-3">

web/convert-image.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Designers",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/designers.html"
4444
},
4545
{
4646
"@type": "ListItem",
4747
"position": 3,
4848
"name": "Marketers",
49-
"item": "https://fasttools.tools/undefined.html"
49+
"item": "https://fasttools.tools/marketers.html"
5050
},
5151
{
5252
"@type": "ListItem",
@@ -82,7 +82,7 @@
8282
<div class="tool-header">
8383
<h1>Convert Image Format</h1>
8484
<p class="text-muted">Convert JPG, PNG and WebP without uploading files.</p>
85-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">🎨 Designers</a> <a href="/undefined.html" class="badge bg-primary text-decoration-none">📱 Marketers</a></small></div>
85+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/designers.html" class="badge bg-primary text-decoration-none">🎨 Designers</a> <a href="/marketers.html" class="badge bg-primary text-decoration-none">📱 Marketers</a></small></div>
8686
</div>
8787

8888
<p class="text-muted">Upload an image and choose the output format.</p>

web/csv-json.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
"@type": "ListItem",
4141
"position": 2,
4242
"name": "Developers",
43-
"item": "https://fasttools.tools/undefined.html"
43+
"item": "https://fasttools.tools/developers.html"
4444
},
4545
{
4646
"@type": "ListItem",
4747
"position": 3,
4848
"name": "Data Analysts",
49-
"item": "https://fasttools.tools/undefined.html"
49+
"item": "https://fasttools.tools/data-analysts.html"
5050
},
5151
{
5252
"@type": "ListItem",
@@ -82,7 +82,7 @@
8282
<div class="tool-header">
8383
<h1>CSV ↔ JSON</h1>
8484
<p class="text-muted">Convert CSV to JSON and JSON to CSV in browser.</p>
85-
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/undefined.html" class="badge bg-primary text-decoration-none">💻 Developers</a> <a href="/undefined.html" class="badge bg-primary text-decoration-none">📊 Data Analysts</a></small></div>
85+
<div class="alert alert-info mt-3"><small>🎯 Useful for: <a href="/developers.html" class="badge bg-primary text-decoration-none">💻 Developers</a> <a href="/data-analysts.html" class="badge bg-primary text-decoration-none">📊 Data Analysts</a></small></div>
8686
</div>
8787

8888
<div id="dropZone" class="drop-zone mb-3">

0 commit comments

Comments
 (0)