docs: consolidate and sanitize documentation for public release

**Changes Summary:**

**Files Deleted (6 files):**
- doc/HTMX-PRODUCTION-RECOMMENDATIONS.md (implementation notes)
- doc/SEO-OPTIMIZATION-COMPLETE.md (implementation artifact)
- doc/PROJECT-DOCUMENTATION-SUMMARY.md (meta-documentation)
- doc/PROJECT_STATUS.md (internal roadmap)
- doc/API-QUICK-REFERENCE.md (consolidated into API.md)
- doc/API-PROTECTION.md (consolidated into API.md and SECURITY.md)

**API Documentation Enhanced:**
- Added Quick Reference section to API.md (from API-QUICK-REFERENCE.md)
- Added Security & Protection section to API.md (from API-PROTECTION.md)
- Updated Rate Limiting section to reflect actual implementation
- Added Origin Checking documentation with examples

**SECURITY.md Enhanced:**
- Added comprehensive API Protection Features section
- Updated Rate Limiting section (was marked "Not implemented", now shows it IS implemented)
- Added Origin Checking configuration and examples
- Added Combined Protection flow documentation
- Added Testing Protection section with curl examples
- Added Production Deployment Checklist
- Added Troubleshooting section

**Private Information Removed:**
- README.md: Removed matomo.drolo.club and site ID references
- PRIVACY.md: Replaced specific Matomo server with generic template
- CUSTOMIZATION.md: Replaced Analytics Configuration with generic guide
- All Matomo-specific details replaced with placeholders

**Documentation Navigation:**
- README.md: Enhanced Documentation section with organized categories
  - Getting Started (README, DEPLOYMENT, CUSTOMIZATION)
  - Technical Reference (ARCHITECTURE, API)
  - Policies & Standards (SECURITY, PRIVACY, CODE_OF_CONDUCT, CONTRIBUTING)
  - License

**Broken Links Fixed:**
- Removed reference to non-existent CHANGELOG.md in API.md
- Fixed relative paths for cross-document references
- Verified all internal documentation links

**Result:**
- Documentation reduced from 16 files to 10 core files (37.5% reduction)
- No private information exposed (all Matomo details sanitized)
- No implementation artifacts remaining
- Clear, professional structure suitable for public instructive project
- Comprehensive API and security documentation
- All essential content preserved and enhanced

This documentation now represents a professional, instructive open-source project suitable for public consumption and learning purposes.
This commit is contained in:
juanatsap
2025-11-12 16:04:43 +00:00
parent 4fcade2207
commit f211d40803
11 changed files with 628 additions and 3137 deletions
+52 -91
View File
@@ -17,8 +17,9 @@
- [Branding](#branding)
- [Template Customization](#template-customization)
- [Analytics Configuration](#analytics-configuration)
- [Option 1: Use Your Own Matomo](#option-1-use-your-own-matomo-instance)
- [Option 2: Remove Matomo](#option-2-remove-matomo-entirely)
- [Option 1: Configure Your Own Analytics](#option-1-configure-your-own-analytics)
- [Option 2: Remove Analytics Entirely](#option-2-remove-analytics-entirely)
- [Option 3: Use Alternative Analytics Service](#option-3-use-alternative-analytics-service)
- [Option 3: Use Alternative Analytics](#option-3-use-google-analytics-or-other-service)
- [Advanced Customization](#advanced-customization)
- [Testing Your Changes](#testing-your-changes)
@@ -93,7 +94,7 @@ open http://localhost:1999
4. Replace `education` section
5. Update `skills` section
6. Replace profile photo
7. **Update Matomo analytics** (see [Analytics Configuration](#analytics-configuration) below)
7. **Configure or remove analytics** (see [Analytics Configuration](#analytics-configuration) below)
---
@@ -1019,130 +1020,90 @@ tmpl := template.New("").Funcs(funcMap)
## Analytics Configuration
**CRITICAL:** If you use this template, you **MUST** update or remove the Matomo analytics configuration.
This template includes a self-hosted analytics implementation as a learning example. You have three options:
### Option 1: Use Your Own Matomo Instance
### Option 1: Configure Your Own Analytics
**Step 1:** Set up your own Matomo server
- Install Matomo on your server or use a hosted service
- Create a new website in Matomo dashboard
- Note your Site ID and server URL
If you want to use self-hosted analytics:
**Step 2:** Update tracking code in `templates/index.html` (around line 635-649)
1. **Set up your analytics server** (Matomo, Plausible, or similar)
Find this section:
```javascript
<!-- Matomo -->
<script>
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://matomo.drolo.club/"; // ← CHANGE THIS
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '4']); // ← CHANGE THIS
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
```
2. **Update tracking code** in `templates/index.html`:
```javascript
// Find this section near the end of the file
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
**Change:**
1. **Line 642:** Replace `https://matomo.drolo.club/` with your Matomo server URL
2. **Line 644:** Replace `'4'` with your Site ID from Matomo dashboard
var u="https://YOUR-ANALYTICS-SERVER.COM/"; // Replace this
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', 'YOUR-SITE-ID']); // Replace this
```
**Step 3:** Update Content Security Policy in `internal/middleware/security.go` (lines 33, 37)
3. **Update CSP headers** in `internal/middleware/security.go`:
```go
// Find the CSP policy and update these directives:
"script-src 'self' 'unsafe-inline' https://YOUR-ANALYTICS-SERVER.COM; " +
"connect-src 'self' https://YOUR-ANALYTICS-SERVER.COM; "
```
Find and update these lines:
```go
// Line 33: Allow your Matomo domain for scripts
"script-src 'self' 'unsafe-inline' https://unpkg.com https://code.iconify.design https://YOUR-MATOMO-DOMAIN.com; " +
4. **Update PRIVACY.md** with your own privacy policy details
// Line 37: Allow your Matomo domain for API calls
"connect-src 'self' https://api.iconify.design https://YOUR-MATOMO-DOMAIN.com; " +
```
Replace `https://matomo.drolo.club` with your Matomo domain.
**Step 4:** Create your own privacy policy
- Copy `PRIVACY.md` and update with your contact information
- Update cookie disclosure with your Matomo server details
- Ensure compliance with GDPR/privacy laws in your jurisdiction
### Option 2: Remove Matomo Entirely
### Option 2: Remove Analytics Entirely
If you don't want analytics:
**Step 1:** Remove tracking code from `templates/index.html`
1. **Remove tracking code** from `templates/index.html`:
- Delete the entire `<!-- Matomo Analytics -->` section (usually at the end of `<body>`)
Delete lines 623-649 (the entire Matomo section):
```javascript
// Delete this entire block:
// Track HTMX navigation events with Matomo
document.body.addEventListener('htmx:afterSwap', function(evt) { ... });
2. **Simplify CSP headers** in `internal/middleware/security.go`:
```go
// Remove analytics domains from:
"script-src 'self' 'unsafe-inline'; " + // Remove analytics domain
"connect-src 'self'; " // Remove analytics domain
```
<!-- Matomo -->
<script> ... </script>
<!-- End Matomo Code -->
```
3. **Update PRIVACY.md**:
- Simplify to state no tracking is used
- Or remove the file if not needed
**Step 2:** Remove Matomo from CSP headers in `internal/middleware/security.go`
### Option 3: Use Alternative Analytics Service
Remove `https://matomo.drolo.club` from lines 33 and 37:
```go
// Before:
"script-src 'self' 'unsafe-inline' https://unpkg.com https://code.iconify.design https://matomo.drolo.club; " +
If you prefer Google Analytics, Plausible Cloud, or another service:
// After:
"script-src 'self' 'unsafe-inline' https://unpkg.com https://code.iconify.design; " +
```
**Step 3:** Update or remove `PRIVACY.md`
- Remove analytics section
- Keep only essential privacy information
### Option 3: Use Google Analytics or Other Service
If you prefer Google Analytics, Plausible, or another service:
1. **Remove Matomo code** (see Option 2 above)
2. **Add your analytics provider's code** in the same location
3. **Update CSP headers** to allow your analytics domain
4. **Update PRIVACY.md** with your analytics provider's details
5. **Ensure compliance** with privacy regulations (GDPR, CCPA, etc.)
1. **Replace tracking code** in `templates/index.html` with your provider's script
2. **Update CSP headers** with your provider's domains
3. **Update PRIVACY.md** according to your provider's data handling
4. **Note**: External services may require additional privacy disclosures (GDPR, CCPA)
### Testing Analytics
After configuration:
```bash
# 1. Build and run
go build -o cv-server . && ./cv-server
# Start development server
make dev
# 2. Open browser with developer tools
# Visit site in browser
open http://localhost:1999
# 3. Check Console for errors
# - Should see Matomo requests if configured
# - Should see no errors about blocked scripts
# 4. Verify in your analytics dashboard
# - Real-time visitors should show your session
# - Language switches should track as pageviews
# Check browser console for errors
# Verify analytics requests in Network tab
```
**Security Note:** Always use HTTPS in production to protect analytics data in transit.
### Privacy Compliance
**Important legal considerations:**
- ✅ Add cookie banner if required in your jurisdiction (EU requires consent)
- ✅ Add cookie consent banner if required in your jurisdiction
- ✅ Create privacy policy explaining data collection
- ✅ Provide opt-out mechanism
- ✅ Comply with GDPR, CCPA, or local privacy laws
- ✅ Update privacy policy when changing analytics providers
**See [PRIVACY.md](PRIVACY.md) for template privacy policy.**
**See [PRIVACY.md](PRIVACY.md) for privacy policy template.**
---