Skip to content

Commit 243ecd1

Browse files
codyjamesbrooksjonsgreen
authored andcommitted
add cache headers for public pages
1 parent cb1563c commit 243ecd1

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

app/controllers/application_controller.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,7 @@ def program_tracks
197197
@program_tracks ||= current_event && current_event.tracks.any? ? current_event.tracks : []
198198
end
199199

200+
def set_cache_headers
201+
expires_in 1.hour, public: true
202+
end
200203
end

app/controllers/pages_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ class PagesController < ApplicationController
22
before_action :require_website, only: :show
33
before_action :require_page, only: :show
44

5+
after_action :set_cache_headers, only: :show
6+
57
def current_styleguide
68
end
79

app/controllers/programs_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
class ProgramsController < ApplicationController
22
before_action :require_website
33

4+
after_action :set_cache_headers, only: :show
5+
46
def show
57
@program_sessions = current_website.event.program_sessions.live
68
render layout: "themes/#{current_website.theme}"

app/controllers/schedule_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ class ScheduleController < ApplicationController
22
include WebsiteScheduleHelper
33
before_action :require_event
44

5+
after_action :set_cache_headers, only: :show
6+
57
decorates_assigned :schedule, with: Staff::TimeSlotDecorator
68

79
def show

app/controllers/sponsors_controller.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
class SponsorsController < ApplicationController
22
before_action :require_website
33

4+
after_action :set_cache_headers, only: :show
5+
46
def show
57
@sponsors_by_tier = Sponsor.published.order_by_tier.group_by(&:tier)
68
render layout: "themes/#{current_website.theme}"

0 commit comments

Comments
 (0)