|
| 1 | +# Plan to Fix Issue #12213: Label Non-Current Event Pages |
| 2 | + |
| 3 | +## Issue Summary |
| 4 | + |
| 5 | +**Title:** Label non-current event pages |
| 6 | + |
| 7 | +**Problem Statement:** |
| 8 | +Marketing teams and sponsors frequently encounter outdated event information when using search engines. Google search results often return previous years' event pages (e.g., 2022 Chicago) before current year pages (e.g., 2023 Chicago), causing confusion about: |
| 9 | +- Outdated sponsorship pricing |
| 10 | +- Incorrect availability status |
| 11 | +- Which event is the current/active one |
| 12 | + |
| 13 | +**Desired Solution:** |
| 14 | +Add a banner to event pages that are NOT the most current year for a given city, identifying them as historical/archived and ideally providing a link to the current iteration of the event. |
| 15 | + |
| 16 | +## Codebase Analysis |
| 17 | + |
| 18 | +### Event Structure |
| 19 | + |
| 20 | +1. **Data Storage:** |
| 21 | + - Event data is stored in `data/events/{year}/{city}/main.yml` |
| 22 | + - Each event has a `year`, `city`, `startdate`, `enddate`, and optional `event_group` field |
| 23 | + - Event slug format: `{year}-{city}` (e.g., `2023-new-york-city`) |
| 24 | + |
| 25 | +2. **Content Structure:** |
| 26 | + - Event pages are in `content/events/{year}-{city}/` |
| 27 | + - Main template: `themes/devopsdays-theme/layouts/event/single.html` |
| 28 | + - Event-specific pages (welcome, program, etc.) use the event layout |
| 29 | + |
| 30 | +3. **Event Detection Logic:** |
| 31 | + - The codebase already has functions to: |
| 32 | + - Get all events: `partials/functions/get-all-events.html` |
| 33 | + - Filter events by city/event_group (seen in `welcome.html` lines 90-116) |
| 34 | + - Determine if events are upcoming or past based on `enddate` vs `now` |
| 35 | + |
| 36 | +4. **Template Structure:** |
| 37 | + - Event pages use `layouts/_default/baseof.html` as the base template |
| 38 | + - Event navbar is rendered via `partials/events/event_navbar.html` |
| 39 | + - Bootstrap alert components are available (`.alert`, `.alert-warning`, etc.) |
| 40 | + |
| 41 | +### Key Files Identified |
| 42 | + |
| 43 | +- `themes/devopsdays-theme/layouts/_default/baseof.html` - Base template for all pages |
| 44 | +- `themes/devopsdays-theme/layouts/event/single.html` - Template for event pages |
| 45 | +- `themes/devopsdays-theme/layouts/partials/events/event_navbar.html` - Event navigation |
| 46 | +- `themes/devopsdays-theme/layouts/partials/functions/get-event-data.html` - Gets current event data |
| 47 | +- `themes/devopsdays-theme/layouts/partials/functions/get-all-events.html` - Gets all events |
| 48 | +- `themes/devopsdays-theme/layouts/partials/welcome.html` - Shows how to find events by city |
| 49 | + |
| 50 | +## Solution Approach |
| 51 | + |
| 52 | +### Phase 1: Create Function to Determine Current Event |
| 53 | + |
| 54 | +**File:** `themes/devopsdays-theme/layouts/partials/functions/get-current-event-for-city.html` |
| 55 | + |
| 56 | +This function will: |
| 57 | +1. Accept the current event's city (or event_group if present) as input |
| 58 | +2. Get all events using `get-all-events` |
| 59 | +3. Filter events matching the city/event_group (case-insensitive, similar to welcome.html logic) |
| 60 | +4. Determine the "current" event as: |
| 61 | + - First preference: The event with the latest `startdate` where `enddate > now` (future event) |
| 62 | + - Second preference: If no future event exists, the event with the latest `startdate` overall |
| 63 | +5. Return the current event object (or empty if none found) |
| 64 | + |
| 65 | +### Phase 2: Create Banner Partial |
| 66 | + |
| 67 | +**File:** `themes/devopsdays-theme/layouts/partials/events/non-current-banner.html` |
| 68 | + |
| 69 | +This partial will: |
| 70 | +1. Get the current event data using `get-event-data` |
| 71 | +2. Call the new function to determine the current event for that city |
| 72 | +3. Compare the current page's event with the "current" event |
| 73 | +4. If they don't match, display a Bootstrap alert banner with: |
| 74 | + - Warning/Info styling |
| 75 | + - Message: "This is a past event from [YEAR]. Visit the [YEAR] event page for current information." |
| 76 | + - Link to the current event's welcome page |
| 77 | + - Prominent positioning (top of content area) |
| 78 | + |
| 79 | +### Phase 3: Integrate Banner into Event Pages |
| 80 | + |
| 81 | +**File:** `themes/devopsdays-theme/layouts/event/single.html` |
| 82 | + |
| 83 | +Modify to: |
| 84 | +1. Include the banner partial before the main content |
| 85 | +2. Ensure it appears on all event pages (welcome, program, speakers, sponsors, etc.) |
| 86 | + |
| 87 | +**Alternative/Additional Location:** `themes/devopsdays-theme/layouts/_default/baseof.html` |
| 88 | + |
| 89 | +Could also add the banner in the base template, checking if the page is an event page and conditionally rendering the banner. This would ensure it appears on ALL event pages automatically. |
| 90 | + |
| 91 | +### Phase 4: Styling Considerations |
| 92 | + |
| 93 | +1. Use Bootstrap alert component (`.alert-warning` or `.alert-info`) |
| 94 | +2. Position at the top of the content area, below the navbar but above event content |
| 95 | +3. Ensure it's responsive and visible on mobile devices |
| 96 | +4. Consider accessibility: proper ARIA labels and high contrast |
| 97 | + |
| 98 | +## Implementation Details |
| 99 | + |
| 100 | +### Determining "Current" Event Logic |
| 101 | + |
| 102 | +```hugo |
| 103 | +{{- $currentEvent := dict -}} |
| 104 | +{{- $futureEvents := slice -}} |
| 105 | +{{- $pastEvents := slice -}} |
| 106 | +
|
| 107 | +{{- range $allEvents -}} |
| 108 | + {{- if matches city/event_group -}} |
| 109 | + {{- if gt (time .enddate) now -}} |
| 110 | + {{- $futureEvents = append . $futureEvents -}} |
| 111 | + {{- else -}} |
| 112 | + {{- $pastEvents = append . $pastEvents -}} |
| 113 | + {{- end -}} |
| 114 | + {{- end -}} |
| 115 | +{{- end -}} |
| 116 | +
|
| 117 | +{{- if $futureEvents -}} |
| 118 | + {{- $currentEvent = (last (sort $futureEvents "startdate")) -}} |
| 119 | +{{- else if $pastEvents -}} |
| 120 | + {{- $currentEvent = (last (sort $pastEvents "startdate")) -}} |
| 121 | +{{- end -}} |
| 122 | +``` |
| 123 | + |
| 124 | +### Banner Content |
| 125 | + |
| 126 | +The banner should include: |
| 127 | +- **Icon:** Consider using a calendar or clock icon (Font Awesome is available) |
| 128 | +- **Message:** Clear indication this is a past event |
| 129 | +- **Year:** Display the year of the current page |
| 130 | +- **Link:** Link to current event's welcome page (`/events/{current-event-name}/`) |
| 131 | +- **CTA:** "View [YEAR] event" or "Visit current event page" |
| 132 | + |
| 133 | +### Edge Cases to Handle |
| 134 | + |
| 135 | +1. **Event Group vs City Name:** |
| 136 | + - Some events use `event_group` instead of `city` for matching (e.g., "New York City") |
| 137 | + - Logic must check both fields (as done in welcome.html) |
| 138 | + |
| 139 | +2. **City Name Variations:** |
| 140 | + - Case-insensitive matching required |
| 141 | + - Some cities may have changed naming (e.g., "newyork" vs "new-york-city") |
| 142 | + |
| 143 | +3. **Events Without Start Dates:** |
| 144 | + - TBD events without start dates should be considered as potential "current" events |
| 145 | + - May need special handling |
| 146 | + |
| 147 | +4. **Single-Year Events:** |
| 148 | + - If a city only has one event, that event is always "current" (banner should not show) |
| 149 | + |
| 150 | +5. **Same-Year Multiple Events:** |
| 151 | + - Rare but possible - use latest startdate within the same year |
| 152 | + |
| 153 | +6. **Canceled Events:** |
| 154 | + - Events marked with `cancel: "true"` should be excluded from "current" determination |
| 155 | + |
| 156 | +## Testing Plan |
| 157 | + |
| 158 | +### Test Cases |
| 159 | + |
| 160 | +1. **Past Event Page:** |
| 161 | + - Visit `/events/2022-chicago/welcome` |
| 162 | + - Should show banner linking to 2023 (or current year) Chicago event |
| 163 | + |
| 164 | +2. **Current Event Page:** |
| 165 | + - Visit `/events/2024-chicago/welcome` |
| 166 | + - Should NOT show banner (assuming 2024 is current) |
| 167 | + |
| 168 | +3. **Cities with Event Groups:** |
| 169 | + - Test New York City which uses `event_group: "New York City"` |
| 170 | + - Banner should still work correctly |
| 171 | + |
| 172 | +4. **Single Event Cities:** |
| 173 | + - Test cities that only have one year |
| 174 | + - Banner should not appear |
| 175 | + |
| 176 | +5. **Multiple Page Types:** |
| 177 | + - Test banner appears on: |
| 178 | + - Welcome page |
| 179 | + - Program page |
| 180 | + - Speakers page |
| 181 | + - Sponsors page |
| 182 | + - Contact page |
| 183 | + - Any other event page |
| 184 | + |
| 185 | +6. **Edge Cases:** |
| 186 | + - Events with no future events (all past) |
| 187 | + - TBD events (no startdate) |
| 188 | + - Canceled events |
| 189 | + |
| 190 | +## Files to Create/Modify |
| 191 | + |
| 192 | +### New Files |
| 193 | + |
| 194 | +1. `themes/devopsdays-theme/layouts/partials/functions/get-current-event-for-city.html` |
| 195 | + - Function to determine current event for a city |
| 196 | + |
| 197 | +2. `themes/devopsdays-theme/layouts/partials/events/non-current-banner.html` |
| 198 | + - Banner partial component |
| 199 | + |
| 200 | +### Modified Files |
| 201 | + |
| 202 | +1. `themes/devopsdays-theme/layouts/event/single.html` |
| 203 | + - Add banner partial inclusion |
| 204 | + |
| 205 | + OR |
| 206 | + |
| 207 | +2. `themes/devopsdays-theme/layouts/_default/baseof.html` |
| 208 | + - Add conditional banner rendering for event pages |
| 209 | + |
| 210 | +## Design Considerations |
| 211 | + |
| 212 | +### Banner Appearance |
| 213 | + |
| 214 | +Suggested design: |
| 215 | +- **Style:** Bootstrap `.alert-warning` (yellow/amber) or `.alert-info` (blue) |
| 216 | +- **Position:** Full-width at top of content, below navbar |
| 217 | +- **Content Structure:** |
| 218 | + ``` |
| 219 | + ⚠️ This is a past event from 2022. |
| 220 | + Visit the 2024 event page for current information. [Link to 2024 event] |
| 221 | + ``` |
| 222 | + |
| 223 | +### Accessibility |
| 224 | + |
| 225 | +- Use proper ARIA roles and labels |
| 226 | +- Ensure sufficient color contrast |
| 227 | +- Make link keyboard accessible |
| 228 | +- Consider screen reader announcements |
| 229 | + |
| 230 | +## Potential Improvements (Future) |
| 231 | + |
| 232 | +1. **SEO Enhancement:** |
| 233 | + - Add canonical link tags pointing to current event |
| 234 | + - Add meta tags indicating this is archived content |
| 235 | + |
| 236 | +2. **Banner Customization:** |
| 237 | + - Allow events to customize banner message via data file |
| 238 | + |
| 239 | +3. **Analytics:** |
| 240 | + - Track clicks on "current event" links to measure impact |
| 241 | + |
| 242 | +4. **Cache Optimization:** |
| 243 | + - Consider caching current event determination since it doesn't change frequently |
| 244 | + |
| 245 | +## Open Questions |
| 246 | + |
| 247 | +1. **Banner Visibility:** |
| 248 | + - Should the banner appear on ALL event pages or just certain ones (e.g., welcome, sponsors)? |
| 249 | + - Recommendation: ALL pages for maximum visibility |
| 250 | + |
| 251 | +2. **Banner Persistence:** |
| 252 | + - Should banner be dismissible? Recommendation: No, to ensure users always see it |
| 253 | + |
| 254 | +3. **Styling:** |
| 255 | + - Use warning (yellow) or info (blue)? Recommendation: Warning for better visibility |
| 256 | + |
| 257 | +4. **Link Text:** |
| 258 | + - What should the link text say? Options: |
| 259 | + - "Visit [YEAR] event" |
| 260 | + - "Go to current event" |
| 261 | + - "View [YEAR] devopsdays [CITY]" |
| 262 | + |
| 263 | +## Success Criteria |
| 264 | + |
| 265 | +1. ✅ Banner appears on all non-current event pages |
| 266 | +2. ✅ Banner correctly identifies current event for each city |
| 267 | +3. ✅ Banner includes working link to current event |
| 268 | +4. ✅ Banner is visually prominent but not intrusive |
| 269 | +5. ✅ Banner works across all event page types |
| 270 | +6. ✅ Handles edge cases (event groups, single events, etc.) |
| 271 | +7. ✅ Mobile responsive |
| 272 | +8. ✅ Accessible (keyboard navigation, screen readers) |
| 273 | + |
| 274 | +## Estimated Effort |
| 275 | + |
| 276 | +- Phase 1 (Function): 2-3 hours |
| 277 | +- Phase 2 (Banner Partial): 1-2 hours |
| 278 | +- Phase 3 (Integration): 1 hour |
| 279 | +- Phase 4 (Styling): 1-2 hours |
| 280 | +- Testing: 2-3 hours |
| 281 | + |
| 282 | +**Total Estimated Time:** 7-11 hours |
| 283 | + |
| 284 | +## Next Steps |
| 285 | + |
| 286 | +1. Review and approve this plan |
| 287 | +2. Begin implementation starting with Phase 1 |
| 288 | +3. Test incrementally after each phase |
| 289 | +4. Create pull request with implementation |
| 290 | +5. Test on staging/preview environment |
| 291 | +6. Gather feedback from maintainers |
| 292 | +7. Merge and deploy |
| 293 | + |
0 commit comments