feat: improve seo urls?

This commit is contained in:
kbe
2025-09-06 01:44:48 +02:00
parent fa99a167a5
commit 5105964b39
22 changed files with 702 additions and 367 deletions

View File

@@ -14,4 +14,48 @@ class ApplicationController < ActionController::Base
# - CSS nesting and :has() pseudo-class
# allow_browser versions: :modern
# allow_browser versions: { safari: 16.4, firefox: 121, ie: false }
protected
# Generate SEO-friendly path for an event
def seo_event_path(event)
year = event.start_time.year
month = format("%02d", event.start_time.month)
event_path(year: year, month: month, slug: event.slug)
end
helper_method :seo_event_path
# Generate SEO-friendly booking URL for an event
def seo_book_tickets_path(event)
year = event.start_time.year
month = format("%02d", event.start_time.month)
book_event_tickets_path(year: year, month: month, slug: event.slug)
end
helper_method :seo_book_tickets_path
# Generate SEO-friendly checkout URL for an event
def seo_checkout_path(event)
year = event.start_time.year
month = format("%02d", event.start_time.month)
event_checkout_path(year: year, month: month, slug: event.slug)
end
helper_method :seo_checkout_path
# Generate SEO-friendly ticket URL
def seo_ticket_path(ticket)
ticket_path(event_slug: ticket.event.slug, ticket_id: ticket.id)
end
helper_method :seo_ticket_path
# Generate SEO-friendly ticket view URL
def seo_ticket_view_path(ticket)
view_ticket_path(event_slug: ticket.event.slug, ticket_id: ticket.id)
end
helper_method :seo_ticket_view_path
# Generate SEO-friendly ticket download URL
def seo_ticket_download_path(ticket)
download_ticket_path(event_slug: ticket.event.slug, ticket_id: ticket.id)
end
helper_method :seo_ticket_download_path
end