feat: Add year-aware PDF shortcut URLs + Default CV modal option

## Shortcut URLs
- New routes: /cv-jamr-{year}-{lang}.pdf (e.g., /cv-jamr-2025-en.pdf)
- Year validation: Only current year accepted, returns 404 for past/future
- Auto-redirects (301) to: /export/pdf?lang={lang}&length=short&icons=show&version=with_skills
- Both languages supported: en and es

## PDF Modal Updates
- Replaced "Current View" option with "Default CV (Recommended)"
- Visual highlighting: purple gradient badge, star emoji , bold text
- Uses shortcut URL with dynamic year detection
- Clear recommendation for users (5 pages, short with skills)

## Technical Details
- Handler: DefaultCVShortcut() in internal/handlers/cv.go
- Pattern check in Home() handler for proper routing
- Helper function: window.openPdfModal() for references section
- Documentation: PDF-SHORTCUT-IMPLEMENTATION.md

Benefits:
- Memorable, shareable URLs (juan.andres.morenorub.io/cv-jamr-2025-en.pdf)
- Auto-updates yearly without code changes
- Clear user guidance for recommended CV format
This commit is contained in:
juanatsap
2025-11-20 12:14:53 +00:00
parent 54cdb0cc19
commit 66e06a6cb0
5 changed files with 277 additions and 16 deletions
+30 -16
View File
@@ -157,12 +157,12 @@
</div>
</div>
<!-- Current View Card -->
<div class="pdf-option-card"
data-cv-format="current"
<!-- Default CV Card (Recommended) -->
<div class="pdf-option-card pdf-option-recommended"
data-cv-format="default"
role="radio"
aria-checked="false"
aria-label="{{if eq .Lang "es"}}Vista Actual - Como se ve en pantalla{{else}}Current View - As shown on screen{{end}}"
aria-label="{{if eq .Lang "es"}}CV Por Defecto - 5 páginas con habilidades (Recomendado){{else}}Default CV - 5 pages with skills (Recommended){{end}}"
tabindex="0"
_="on click
-- Remove selected from all cards
@@ -185,8 +185,8 @@
-- Announce to screen readers
set announcement to #pdf-selection-announcement
if :selectedFormat is 'current'
set announcement.textContent to '{{if eq .Lang "es"}}Seleccionado: Vista Actual{{else}}Selected: Current View{{end}}'
if :selectedFormat is 'default'
set announcement.textContent to '{{if eq .Lang "es"}}Seleccionado: CV Por Defecto (Recomendado){{else}}Selected: Default CV (Recommended){{end}}'
end
end
@@ -197,22 +197,32 @@
end
end">
<div class="pdf-thumbnail thumbnail-custom">
<!-- Centered icon representing current screen view -->
<div class="custom-placeholder">
<iconify-icon icon="mdi:monitor" width="80" height="80"></iconify-icon>
<p>{{if eq .Lang "es"}}En Pantalla{{else}}On Screen{{end}}</p>
<div class="pdf-thumbnail thumbnail-default">
<!-- Two-column layout with sidebar -->
<div class="skeleton-block" style="height: 36px; margin-bottom: 6px;"></div>
<div style="display: flex; gap: 4px;">
<div style="width: 25%; display: flex; flex-direction: column; gap: 3px;">
<div class="skeleton-block" style="height: 20px;"></div>
<div class="skeleton-block" style="height: 16px;"></div>
</div>
<div style="width: 75%; display: flex; flex-direction: column; gap: 3px;">
<div class="skeleton-block" style="height: 32px;"></div>
<div class="skeleton-block" style="height: 32px;"></div>
</div>
</div>
<!-- Current view badge -->
<div class="thumbnail-badge">
{{if eq .Lang "es"}}Vista Actual{{else}}Current{{end}}
<!-- Page count badge with star -->
<div class="thumbnail-badge" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); font-weight: 600;">
{{if eq .Lang "es"}}5 Páginas{{else}}5 Pages{{end}}
</div>
</div>
<div class="pdf-option-info">
<h3>{{if eq .Lang "es"}}Vista Actual{{else}}Current View{{end}}</h3>
<p>{{if eq .Lang "es"}}Como se ve en pantalla{{else}}As shown on screen{{end}}</p>
<h3>
{{if eq .Lang "es"}}CV Por Defecto{{else}}Default CV{{end}}
<span style="color: #667eea; font-size: 0.9em;"></span>
</h3>
<p style="font-weight: 500;">{{if eq .Lang "es"}}Corto con habilidades - Recomendado{{else}}Short with skills - Recommended{{end}}</p>
</div>
<div class="pdf-option-badge">
@@ -249,6 +259,10 @@
if (selectedFormat === 'short') {
// Short CV: clean version (no skills), short length
url = `/export/pdf?lang=${lang}&length=short&icons=show&version=clean`;
} else if (selectedFormat === 'default') {
// Default CV: use shortcut URL (short with skills, 5 pages)
const currentYear = new Date().getFullYear();
url = `/cv-jamr-${currentYear}-${lang}.pdf`;
} else if (selectedFormat === 'long') {
// Long CV: with skills sidebar, long length
url = `/export/pdf?lang=${lang}&length=long&icons=show&version=with_skills`;