|
| 1 | +# 🚀 Dynamic Document Page Generator |
| 2 | + |
| 3 | +This system automatically generates individual HTML pages for each document in your telecom security collection, creating a comprehensive and navigable documentation website. |
| 4 | + |
| 5 | +## ✨ Features |
| 6 | + |
| 7 | +- **Automatic Page Generation**: Creates individual HTML pages for each document |
| 8 | +- **Consistent Design**: All pages use the same professional template and styling |
| 9 | +- **Rich Metadata**: Each page includes comprehensive document information |
| 10 | +- **Related Documents**: Automatic linking between related documents |
| 11 | +- **Responsive Design**: Mobile-friendly pages with modern UI |
| 12 | +- **SEO Optimized**: Proper meta tags and structured content |
| 13 | +- **Easy Navigation**: Breadcrumb navigation and category links |
| 14 | + |
| 15 | +## 🏗️ Architecture |
| 16 | + |
| 17 | +``` |
| 18 | +├── document-template.html # HTML template for individual pages |
| 19 | +├── document-styles.css # CSS styles for document pages |
| 20 | +├── generate-pages.js # Node.js script to generate pages |
| 21 | +├── documents/ # Generated individual pages |
| 22 | +│ ├── index.html # Documents index page |
| 23 | +│ ├── 4g-security-overview.html |
| 24 | +│ ├── 5g-security-architecture.html |
| 25 | +│ └── ... # More document pages |
| 26 | +└── package.json # NPM scripts for generation |
| 27 | +``` |
| 28 | + |
| 29 | +## 🚀 Quick Start |
| 30 | + |
| 31 | +### 1. Install Dependencies |
| 32 | +```bash |
| 33 | +npm install |
| 34 | +``` |
| 35 | + |
| 36 | +### 2. Generate All Document Pages |
| 37 | +```bash |
| 38 | +npm run generate |
| 39 | +``` |
| 40 | + |
| 41 | +### 3. Start Local Development Server |
| 42 | +```bash |
| 43 | +npm start |
| 44 | +``` |
| 45 | + |
| 46 | +## 📝 How It Works |
| 47 | + |
| 48 | +### Document Database |
| 49 | +The `generate-pages.js` script contains a `documents` array with metadata for each document: |
| 50 | + |
| 51 | +```javascript |
| 52 | +{ |
| 53 | + id: '4g-security-overview', |
| 54 | + title: '4G Network Security Overview', |
| 55 | + description: 'Comprehensive overview of 4G network security...', |
| 56 | + category: '4G Network Security', |
| 57 | + categoryAnchor: '4g', |
| 58 | + type: 'Technical Report', |
| 59 | + date: '2024-01-15', |
| 60 | + source: '3GPP', |
| 61 | + filePath: '../4G/4G_Security_Overview.pdf', |
| 62 | + fileName: '4G_Security_Overview.pdf', |
| 63 | + abstract: 'This document provides...', |
| 64 | + keyTopics: ['LTE Security', 'Authentication', 'Encryption'], |
| 65 | + relatedDocuments: ['4g-authentication', '4g-encryption'] |
| 66 | +} |
| 67 | +``` |
| 68 | + |
| 69 | +### Template System |
| 70 | +Each document page is generated from `document-template.html` using placeholder variables: |
| 71 | + |
| 72 | +- `{{DOCUMENT_TITLE}}` → Document title |
| 73 | +- `{{CATEGORY_NAME}}` → Category name |
| 74 | +- `{{ABSTRACT}}` → Document abstract |
| 75 | +- `{{KEY_TOPICS}}` → Key topics as styled tags |
| 76 | +- `{{RELATED_DOCUMENTS}}` → Links to related documents |
| 77 | + |
| 78 | +### Generation Process |
| 79 | +1. **Read Template**: Loads the HTML template |
| 80 | +2. **Replace Placeholders**: Substitutes variables with actual content |
| 81 | +3. **Generate HTML**: Creates formatted HTML for topics and related documents |
| 82 | +4. **Write Files**: Saves individual HTML files to `documents/` directory |
| 83 | +5. **Create Index**: Generates a master index page for all documents |
| 84 | + |
| 85 | +## 🎨 Customization |
| 86 | + |
| 87 | +### Adding New Documents |
| 88 | +1. Add document metadata to the `documents` array in `generate-pages.js` |
| 89 | +2. Run `npm run generate` to create the new page |
| 90 | +3. The page will automatically include proper navigation and styling |
| 91 | + |
| 92 | +### Modifying the Template |
| 93 | +1. Edit `document-template.html` to change the page structure |
| 94 | +2. Add new placeholder variables as needed |
| 95 | +3. Update `generate-pages.js` to handle new variables |
| 96 | + |
| 97 | +### Styling Changes |
| 98 | +1. Modify `document-styles.css` for visual changes |
| 99 | +2. The styles are automatically copied to the documents directory |
| 100 | + |
| 101 | +## 📱 Generated Page Features |
| 102 | + |
| 103 | +### Document Header |
| 104 | +- **Breadcrumb Navigation**: Home → Category → Document |
| 105 | +- **Document Title**: Large, prominent display |
| 106 | +- **Description**: Brief overview |
| 107 | +- **Metadata Badges**: Category, type, date |
| 108 | + |
| 109 | +### Document Content |
| 110 | +- **Information Grid**: Document details in organized layout |
| 111 | +- **Abstract**: Document summary in highlighted box |
| 112 | +- **Key Topics**: Styled topic tags |
| 113 | +- **Related Documents**: Links to related content |
| 114 | +- **Action Buttons**: Download and navigation |
| 115 | + |
| 116 | +### Navigation |
| 117 | +- **Fixed Navigation Bar**: Always accessible |
| 118 | +- **Category Links**: Easy return to category pages |
| 119 | +- **Related Document Links**: Cross-reference navigation |
| 120 | +- **Back to Home**: Return to main site |
| 121 | + |
| 122 | +## 🔧 Advanced Usage |
| 123 | + |
| 124 | +### Watch Mode (Development) |
| 125 | +```bash |
| 126 | +npm run generate:watch |
| 127 | +``` |
| 128 | +Automatically regenerates pages when files change (requires nodemon). |
| 129 | + |
| 130 | +### Custom Generation |
| 131 | +```javascript |
| 132 | +const { generateAllPages } = require('./generate-pages.js'); |
| 133 | +generateAllPages(); // Generate pages programmatically |
| 134 | +``` |
| 135 | + |
| 136 | +### Batch Processing |
| 137 | +The system can handle large numbers of documents efficiently: |
| 138 | +- Processes documents in parallel where possible |
| 139 | +- Creates optimized HTML output |
| 140 | +- Maintains consistent file structure |
| 141 | + |
| 142 | +## 📊 Performance |
| 143 | + |
| 144 | +### Generation Speed |
| 145 | +- **Small Collection** (< 50 docs): ~1-2 seconds |
| 146 | +- **Medium Collection** (50-200 docs): ~3-5 seconds |
| 147 | +- **Large Collection** (200+ docs): ~5-10 seconds |
| 148 | + |
| 149 | +### Page Load Time |
| 150 | +- **Individual Pages**: < 100ms (static HTML) |
| 151 | +- **CSS/JS**: Cached by browser |
| 152 | +- **Images**: Optimized loading |
| 153 | + |
| 154 | +## 🚀 Deployment |
| 155 | + |
| 156 | +### GitHub Pages |
| 157 | +1. Generate pages: `npm run generate` |
| 158 | +2. Commit and push changes |
| 159 | +3. Pages are automatically available at your GitHub Pages URL |
| 160 | + |
| 161 | +### Other Hosting |
| 162 | +1. Generate pages: `npm run generate` |
| 163 | +2. Upload `documents/` directory to your web server |
| 164 | +3. Ensure proper file permissions |
| 165 | + |
| 166 | +## 🐛 Troubleshooting |
| 167 | + |
| 168 | +### Common Issues |
| 169 | + |
| 170 | +**Pages not generating:** |
| 171 | +- Check Node.js version (requires 14+) |
| 172 | +- Verify file permissions |
| 173 | +- Check console for error messages |
| 174 | + |
| 175 | +**Styling issues:** |
| 176 | +- Ensure `document-styles.css` is copied to documents directory |
| 177 | +- Check CSS file paths in generated HTML |
| 178 | +- Verify Bootstrap and Font Awesome CDN links |
| 179 | + |
| 180 | +**Navigation problems:** |
| 181 | +- Check relative paths in generated HTML |
| 182 | +- Verify category anchors exist in main index |
| 183 | +- Test links manually |
| 184 | + |
| 185 | +### Debug Mode |
| 186 | +Add logging to see generation process: |
| 187 | +```javascript |
| 188 | +console.log('Generating:', document.title); |
| 189 | +console.log('Output path:', filePath); |
| 190 | +``` |
| 191 | + |
| 192 | +## 🔮 Future Enhancements |
| 193 | + |
| 194 | +### Planned Features |
| 195 | +- **Search Functionality**: Full-text search across documents |
| 196 | +- **Category Pages**: Dedicated pages for each category |
| 197 | +- **Tag System**: Advanced topic tagging and filtering |
| 198 | +- **PDF Preview**: Embedded PDF viewers |
| 199 | +- **Comments System**: User feedback and discussions |
| 200 | +- **Version Control**: Document version tracking |
| 201 | + |
| 202 | +### Integration Options |
| 203 | +- **CMS Integration**: Connect to content management systems |
| 204 | +- **API Endpoints**: RESTful API for document access |
| 205 | +- **Database Backend**: Store metadata in database |
| 206 | +- **Authentication**: User access control |
| 207 | +- **Analytics**: Document usage tracking |
| 208 | + |
| 209 | +## 📚 Documentation |
| 210 | + |
| 211 | +### File Structure |
| 212 | +- `document-template.html` - HTML template |
| 213 | +- `document-styles.css` - Page-specific styles |
| 214 | +- `generate-pages.js` - Generation script |
| 215 | +- `package.json` - NPM configuration |
| 216 | +- `DYNAMIC-PAGES.md` - This documentation |
| 217 | + |
| 218 | +### Script Commands |
| 219 | +- `npm run generate` - Generate all pages |
| 220 | +- `npm run generate:watch` - Watch mode for development |
| 221 | +- `npm run build` - Build alias for generate |
| 222 | +- `npm start` - Start local development server |
| 223 | + |
| 224 | +### Configuration |
| 225 | +- Document metadata in `generate-pages.js` |
| 226 | +- Styling in `document-styles.css` |
| 227 | +- Template structure in `document-template.html` |
| 228 | +- Build settings in `package.json` |
| 229 | + |
| 230 | +## 🤝 Contributing |
| 231 | + |
| 232 | +### Adding Documents |
| 233 | +1. Add metadata to the documents array |
| 234 | +2. Ensure proper categorization |
| 235 | +3. Include relevant topics and related documents |
| 236 | +4. Test generated pages locally |
| 237 | + |
| 238 | +### Improving Templates |
| 239 | +1. Modify HTML template as needed |
| 240 | +2. Update CSS for styling changes |
| 241 | +3. Test across different document types |
| 242 | +4. Ensure responsive design |
| 243 | + |
| 244 | +### Bug Reports |
| 245 | +1. Check console for error messages |
| 246 | +2. Verify file paths and permissions |
| 247 | +3. Test with minimal document set |
| 248 | +4. Provide detailed error information |
| 249 | + |
| 250 | +--- |
| 251 | + |
| 252 | +**🎯 Ready to generate your document pages? Run `npm run generate` to get started!** |
0 commit comments