Implementierung - SEO - 01.08.2025

This commit is contained in:
2025-08-01 20:33:47 +02:00
parent f176743885
commit e69e68242c
32 changed files with 12822 additions and 192 deletions
+28
View File
@@ -0,0 +1,28 @@
const https = require('https');
const fs = require('fs');
const path = require('path');
const FONTS_DIR = path.join(__dirname, '..', 'public', 'fonts');
// Ensure fonts directory exists
if (!fs.existsSync(FONTS_DIR)) {
fs.mkdirSync(FONTS_DIR, { recursive: true });
}
// Download Inter font
const INTER_URL = 'https://rsms.me/inter/font-files/InterVariable.woff2';
const INTER_PATH = path.join(FONTS_DIR, 'inter-var.woff2');
console.log('Downloading Inter font...');
const file = fs.createWriteStream(INTER_PATH);
https.get(INTER_URL, (response) => {
response.pipe(file);
file.on('finish', () => {
file.close();
console.log('Inter font downloaded successfully!');
});
}).on('error', (err) => {
fs.unlink(INTER_PATH, () => {});
console.error('Error downloading font:', err.message);
});
+32
View File
@@ -0,0 +1,32 @@
import https from 'https';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const FONTS_DIR = path.join(__dirname, '..', 'public', 'fonts');
// Ensure fonts directory exists
if (!fs.existsSync(FONTS_DIR)) {
fs.mkdirSync(FONTS_DIR, { recursive: true });
}
// Download Inter font
const INTER_URL = 'https://rsms.me/inter/font-files/InterVariable.woff2';
const INTER_PATH = path.join(FONTS_DIR, 'inter-var.woff2');
console.log('Downloading Inter font...');
const file = fs.createWriteStream(INTER_PATH);
https.get(INTER_URL, (response) => {
response.pipe(file);
file.on('finish', () => {
file.close();
console.log('Inter font downloaded successfully!');
});
}).on('error', (err) => {
fs.unlink(INTER_PATH, () => {});
console.error('Error downloading font:', err.message);
});
+26
View File
@@ -0,0 +1,26 @@
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const PUBLIC_DIR = path.join(__dirname, '..', 'public');
// Create simple placeholder SVG icons
const svg192 = `<svg width="192" height="192" xmlns="http://www.w3.org/2000/svg">
<rect width="192" height="192" fill="#18181b"/>
<text x="50%" y="50%" font-family="Arial, sans-serif" font-size="80" fill="white" text-anchor="middle" dominant-baseline="middle">DS</text>
</svg>`;
const svg512 = `<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
<rect width="512" height="512" fill="#18181b"/>
<text x="50%" y="50%" font-family="Arial, sans-serif" font-size="200" fill="white" text-anchor="middle" dominant-baseline="middle">DS</text>
</svg>`;
// Convert SVG to PNG using Canvas API (simple approach)
// For now, we'll just save as SVG files
fs.writeFileSync(path.join(PUBLIC_DIR, 'icon-192x192.svg'), svg192);
fs.writeFileSync(path.join(PUBLIC_DIR, 'icon-512x512.svg'), svg512);
console.log('Placeholder SVG icons created. Note: These are SVG files, not PNG. Update manifest accordingly.');
+59
View File
@@ -0,0 +1,59 @@
import sharp from 'sharp';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const PUBLIC_DIR = path.join(__dirname, '..', 'public');
const SOURCE_IMAGE = path.join(PUBLIC_DIR, 'logo.png');
async function generateIcons() {
try {
// Check if source image exists
if (!fs.existsSync(SOURCE_IMAGE)) {
console.error('Source logo.png not found in public directory');
// Create placeholder icons
const svg = `
<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
<rect width="512" height="512" fill="#18181b"/>
<text x="50%" y="50%" font-family="Arial, sans-serif" font-size="200" fill="white" text-anchor="middle" dominant-baseline="middle">DS</text>
</svg>
`;
// Generate 192x192 icon
await sharp(Buffer.from(svg))
.resize(192, 192)
.png()
.toFile(path.join(PUBLIC_DIR, 'icon-192x192.png'));
// Generate 512x512 icon
await sharp(Buffer.from(svg))
.resize(512, 512)
.png()
.toFile(path.join(PUBLIC_DIR, 'icon-512x512.png'));
console.log('Placeholder icons created successfully');
return;
}
// Generate icons from source image
await sharp(SOURCE_IMAGE)
.resize(192, 192)
.png()
.toFile(path.join(PUBLIC_DIR, 'icon-192x192.png'));
await sharp(SOURCE_IMAGE)
.resize(512, 512)
.png()
.toFile(path.join(PUBLIC_DIR, 'icon-512x512.png'));
console.log('Icons generated successfully');
} catch (error) {
console.error('Error generating icons:', error);
}
}
generateIcons();