Skip to content

Commit 1a355f0

Browse files
committed
hh
1 parent a533268 commit 1a355f0

File tree

6 files changed

+49
-50
lines changed

6 files changed

+49
-50
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
"main": "index.html",
66
"scripts": {
77
"start": "http-server -p 8080 -o",
8-
"generate": "node scripts/generate-pages.js",
8+
"generate": "node scripts/generate-from-yaml.js",
99
"generate:yaml": "node scripts/generate-from-yaml.js",
10-
"generate:watch": "nodemon scripts/generate-pages.js",
10+
"generate:watch": "nodemon scripts/generate-from-yaml.js",
1111
"build": "npm run generate:yaml && npm run seo && npm run optimize:images",
1212
"validate": "node scripts/check-errors.js",
1313
"seo": "node scripts/generate-sitemap.js",

rss.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<link>https://library.telco-sec.com</link>
66
<description>Comprehensive collection of telecommunications security research papers, technical documents, and security analysis for professionals, researchers, and industry experts</description>
77
<language>en-us</language>
8-
<lastBuildDate>Tue, 17 Feb 2026 22:18:42 GMT</lastBuildDate>
8+
<lastBuildDate>Tue, 17 Feb 2026 22:38:12 GMT</lastBuildDate>
99
<atom:link href="https://library.telco-sec.com/rss.xml" rel="self" type="application/rss+xml" />
1010

1111
<item>

scripts/enhance-internal-linking.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class InternalLinkingEnhancer {
1616
loadDocuments() {
1717
try {
1818
console.log('📚 Loading documents from YAML...');
19-
const documentsYaml = fs.readFileSync('content/documents.yaml', 'utf8');
19+
const documentsYaml = fs.readFileSync(path.join(__dirname, '..', 'content', 'documents.yaml'), 'utf8');
2020
const data = yaml.load(documentsYaml);
2121

2222
if (data && data.documents) {
@@ -336,15 +336,15 @@ class InternalLinkingEnhancer {
336336
sitemap += `- [${doc.title}](./${doc.id}.html) - ${doc.category}\n`;
337337
});
338338

339-
fs.writeFileSync('INTERNAL-SITEMAP.md', sitemap);
339+
fs.writeFileSync(path.join(__dirname, '..', 'INTERNAL-SITEMAP.md'), sitemap);
340340
console.log('✅ Internal sitemap generated');
341341
}
342342

343343
// Generate enhanced document template with internal linking
344344
enhanceDocumentTemplate() {
345345
console.log('🔗 Enhancing document template with internal linking...');
346346

347-
const templatePath = 'document-template.html';
347+
const templatePath = path.join(__dirname, '..', 'document-template.html');
348348
if (!fs.existsSync(templatePath)) {
349349
console.error('❌ Document template not found');
350350
return;
@@ -367,7 +367,7 @@ class InternalLinkingEnhancer {
367367
'{{ENHANCED_BREADCRUMB}}'
368368
);
369369

370-
fs.writeFileSync('document-template-enhanced.html', template);
370+
fs.writeFileSync(path.join(__dirname, '..', 'document-template-enhanced.html'), template);
371371
console.log('✅ Enhanced document template created');
372372
}
373373

@@ -407,7 +407,7 @@ class InternalLinkingEnhancer {
407407
}
408408
});
409409

410-
fs.writeFileSync('INTERNAL-LINKING-REPORT.md', report);
410+
fs.writeFileSync(path.join(__dirname, '..', 'INTERNAL-LINKING-REPORT.md'), report);
411411
console.log('✅ Internal linking report generated');
412412
}
413413

scripts/generate-enhanced-sitemap.js

Lines changed: 33 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class EnhancedSitemapGenerator {
1515
// Generate main sitemap
1616
generateMainSitemap() {
1717
console.log('🚀 Generating enhanced main sitemap...');
18-
18+
1919
// Add core pages with proper priorities and change frequencies
2020
this.addUrl('/', '1.0', 'weekly', 'Homepage');
2121
this.addUrl('/about.html', '0.8', 'monthly', 'About Page');
@@ -24,49 +24,48 @@ class EnhancedSitemapGenerator {
2424
this.addUrl('/images.html', '0.9', 'weekly', 'Images Page');
2525
this.addUrl('/partners.html', '0.8', 'monthly', 'Partners Page');
2626
this.addUrl('/documents/index.html', '0.9', 'weekly', 'Documents Index');
27-
27+
2828
// Add category landing pages
2929
this.addCategoryPages();
30-
30+
3131
// Add individual document pages
3232
this.addDocumentPages();
33-
33+
3434
// Generate the sitemap XML
3535
const sitemapXml = this.generateSitemapXml();
36-
fs.writeFileSync('sitemap.xml', sitemapXml);
36+
fs.writeFileSync(path.join(__dirname, '..', 'sitemap.xml'), sitemapXml);
3737
console.log(`✅ Main sitemap generated with ${this.sitemapUrls.length} URLs`);
38-
38+
3939
return this.sitemapUrls;
4040
}
4141

4242
// Generate image sitemap
4343
generateImageSitemap() {
4444
console.log('🖼️ Generating image sitemap...');
45-
45+
4646
// Add images from the images directory
4747
this.addImagesFromDirectory();
48-
48+
4949
// Generate the image sitemap XML
5050
const imageSitemapXml = this.generateImageSitemapXml();
51-
fs.writeFileSync('sitemap-images.xml', imageSitemapXml);
51+
fs.writeFileSync(path.join(__dirname, '..', 'sitemap-images.xml'), imageSitemapXml);
5252
console.log(`✅ Image sitemap generated with ${this.imageSitemapUrls.length} URLs`);
53-
53+
5454
return this.imageSitemapUrls;
5555
}
5656

5757
// Generate video sitemap
5858
generateVideoSitemap() {
5959
console.log('🎥 Generating video sitemap...');
60-
60+
6161
// Add videos from videos.yaml
6262
this.addVideosFromYaml();
63-
63+
6464
// Generate the video sitemap XML
6565
const videoSitemapXml = this.generateVideoSitemapXml();
66-
fs.writeFileSync('sitemap-videos.xml', videoSitemapXml);
67-
fs.writeFileSync('sitemap-videos.xml', videoSitemapXml);
66+
fs.writeFileSync(path.join(__dirname, '..', 'sitemap-videos.xml'), videoSitemapXml);
6867
console.log(`✅ Video sitemap generated with ${this.videoSitemapUrls.length} URLs`);
69-
68+
7069
return this.videoSitemapUrls;
7170
}
7271

@@ -111,14 +110,14 @@ class EnhancedSitemapGenerator {
111110
// Add document pages from YAML
112111
addDocumentPages() {
113112
try {
114-
const documentsYaml = fs.readFileSync('content/documents.yaml', 'utf8');
113+
const documentsYaml = fs.readFileSync(path.join(__dirname, '..', 'content', 'documents.yaml'), 'utf8');
115114
const documents = yaml.load(documentsYaml);
116-
115+
117116
if (documents && documents.documents) {
118117
documents.documents.forEach(doc => {
119118
const docPath = `/documents/${doc.id}.html`;
120119
this.addUrl(docPath, '0.8', 'monthly', doc.title);
121-
120+
122121
// Add related documents for internal linking
123122
if (doc.relatedDocuments) {
124123
doc.relatedDocuments.forEach(related => {
@@ -137,7 +136,7 @@ class EnhancedSitemapGenerator {
137136

138137
// Add images from directory
139138
addImagesFromDirectory() {
140-
const imagesDir = 'images';
139+
const imagesDir = path.join(__dirname, '..', 'images');
141140
if (fs.existsSync(imagesDir)) {
142141
const imageFiles = this.getImageFiles(imagesDir);
143142
imageFiles.forEach(image => {
@@ -156,12 +155,12 @@ class EnhancedSitemapGenerator {
156155
getImageFiles(dir, baseDir = '') {
157156
const files = [];
158157
const items = fs.readdirSync(dir);
159-
158+
160159
items.forEach(item => {
161160
const fullPath = path.join(dir, item);
162161
const relativePath = path.join(baseDir, item);
163162
const stat = fs.statSync(fullPath);
164-
163+
165164
if (stat.isDirectory()) {
166165
files.push(...this.getImageFiles(fullPath, relativePath));
167166
} else if (this.isImageFile(item)) {
@@ -174,7 +173,7 @@ class EnhancedSitemapGenerator {
174173
});
175174
}
176175
});
177-
176+
178177
return files;
179178
}
180179

@@ -200,9 +199,9 @@ class EnhancedSitemapGenerator {
200199
// Add videos from YAML
201200
addVideosFromYaml() {
202201
try {
203-
const videosYaml = fs.readFileSync('content/videos.yaml', 'utf8');
202+
const videosYaml = fs.readFileSync(path.join(__dirname, '..', 'content', 'videos.yaml'), 'utf8');
204203
const videos = yaml.load(videosYaml);
205-
204+
206205
if (videos && videos.videos) {
207206
videos.videos.forEach(video => {
208207
this.videoSitemapUrls.push({
@@ -228,7 +227,7 @@ class EnhancedSitemapGenerator {
228227
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
229228
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
230229
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">\n\n`;
231-
230+
232231
this.sitemapUrls.forEach(url => {
233232
xml += ` <url>
234233
<loc>${url.loc}</loc>
@@ -237,7 +236,7 @@ class EnhancedSitemapGenerator {
237236
<priority>${url.priority}</priority>
238237
</url>\n`;
239238
});
240-
239+
241240
xml += '\n</urlset>';
242241
return xml;
243242
}
@@ -247,7 +246,7 @@ class EnhancedSitemapGenerator {
247246
let xml = `<?xml version="1.0" encoding="UTF-8"?>
248247
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
249248
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">\n\n`;
250-
249+
251250
this.imageSitemapUrls.forEach(url => {
252251
xml += ` <url>
253252
<loc>${url.loc}</loc>
@@ -259,7 +258,7 @@ class EnhancedSitemapGenerator {
259258
</image:image>
260259
</url>\n`;
261260
});
262-
261+
263262
xml += '\n</urlset>';
264263
return xml;
265264
}
@@ -269,7 +268,7 @@ class EnhancedSitemapGenerator {
269268
let xml = `<?xml version="1.0" encoding="UTF-8"?>
270269
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
271270
xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">\n\n`;
272-
271+
273272
this.videoSitemapUrls.forEach(url => {
274273
xml += ` <url>
275274
<loc>${url.loc}</loc>
@@ -283,7 +282,7 @@ class EnhancedSitemapGenerator {
283282
</video:video>
284283
</url>\n`;
285284
});
286-
285+
287286
xml += '\n</urlset>';
288287
return xml;
289288
}
@@ -305,20 +304,20 @@ class EnhancedSitemapGenerator {
305304
<lastmod>${this.currentDate}</lastmod>
306305
</sitemap>
307306
</sitemapindex>`;
308-
309-
fs.writeFileSync('sitemap-index.xml', sitemapIndex);
307+
308+
fs.writeFileSync(path.join(__dirname, '..', 'sitemap-index.xml'), sitemapIndex);
310309
console.log('✅ Sitemap index generated');
311310
}
312311

313312
// Generate all sitemaps
314313
generateAll() {
315314
console.log('🚀 Starting enhanced sitemap generation...\n');
316-
315+
317316
this.generateMainSitemap();
318317
this.generateImageSitemap();
319318
this.generateVideoSitemap();
320319
this.generateSitemapIndex();
321-
320+
322321
console.log('\n🎉 All sitemaps generated successfully!');
323322
console.log('\n📊 Sitemap Summary:');
324323
console.log(` Main Sitemap: ${this.sitemapUrls.length} URLs`);

scripts/generate-sitemap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const yaml = require('js-yaml');
77
// Load content from YAML file
88
function loadContent() {
99
try {
10-
const yamlPath = path.join(__dirname, 'content', 'documents.yaml');
10+
const yamlPath = path.join(__dirname, '..', 'content', 'documents.yaml');
1111
const yamlContent = fs.readFileSync(yamlPath, 'utf8');
1212
const content = yaml.load(yamlContent);
1313

@@ -86,7 +86,7 @@ ${content.categories.map(cat => ` <url>
8686
</urlset>`;
8787

8888
// Write sitemap to file
89-
fs.writeFileSync('sitemap.xml', sitemap);
89+
fs.writeFileSync(path.join(__dirname, '..', 'sitemap.xml'), sitemap);
9090
console.log('✅ sitemap.xml generated successfully!');
9191
console.log(`📊 Total URLs: ${content.documents.length + content.categories.length + 3}`); // documents + categories + static pages
9292
}
@@ -119,7 +119,7 @@ ${content.documents.map(doc => ` <item>
119119
</channel>
120120
</rss>`;
121121

122-
fs.writeFileSync('rss.xml', rssFeed);
122+
fs.writeFileSync(path.join(__dirname, '..', 'rss.xml'), rssFeed);
123123
console.log('✅ RSS feed generated successfully!');
124124
}
125125

scripts/production-seo-optimizer.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class ProductionSEOOptimizer {
6262
console.log('🤖 Optimizing robots.txt...');
6363

6464
try {
65-
const robotsContent = fs.readFileSync('robots.txt', 'utf8');
65+
const robotsContent = fs.readFileSync(path.join(__dirname, '..', 'robots.txt'), 'utf8');
6666

6767
// Check if robots.txt is already optimized
6868
if (robotsContent.includes('Enhanced Robots.txt for Telecom Security Library')) {
@@ -157,7 +157,7 @@ Host: https://telcosec.github.io
157157
# Crawl delay for all bots (respectful crawling)
158158
Crawl-delay: 1`;
159159

160-
fs.writeFileSync('robots.txt', optimizedRobots);
160+
fs.writeFileSync(path.join(__dirname, '..', 'robots.txt'), optimizedRobots);
161161
this.optimizations.push('✅ Robots.txt optimized for production');
162162
console.log('✅ Robots.txt optimized');
163163

@@ -193,15 +193,15 @@ Crawl-delay: 1`;
193193
try {
194194
// Generate main SEO report
195195
const seoReport = this.generateMainSEOReport();
196-
fs.writeFileSync('SEO-OPTIMIZATION-REPORT.md', seoReport);
196+
fs.writeFileSync(path.join(__dirname, '..', 'SEO-OPTIMIZATION-REPORT.md'), seoReport);
197197

198198
// Generate technical SEO checklist
199199
const technicalChecklist = this.generateTechnicalChecklist();
200-
fs.writeFileSync('TECHNICAL-SEO-CHECKLIST.md', technicalChecklist);
200+
fs.writeFileSync(path.join(__dirname, '..', 'TECHNICAL-SEO-CHECKLIST.md'), technicalChecklist);
201201

202202
// Generate performance optimization guide
203203
const performanceGuide = this.generatePerformanceGuide();
204-
fs.writeFileSync('PERFORMANCE-OPTIMIZATION-GUIDE.md', performanceGuide);
204+
fs.writeFileSync(path.join(__dirname, '..', 'PERFORMANCE-OPTIMIZATION-GUIDE.md'), performanceGuide);
205205

206206
this.optimizations.push('✅ Comprehensive SEO reports generated');
207207
console.log('✅ SEO reports generated');

0 commit comments

Comments
 (0)