0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 12:09:27 +08:00
discourse/lib/top_menu.rb
Penar Musaraj 99c63660d4
FEATURE: Allow fallback home routes for crawlers for custom homepage sites (#41234)
When using a custom homepage, the crawler view currently is limited, it
only shows the site's top menu. Instead, let's add a default fallback
route (/latest) and an admin site setting where the admin can pick
another fallback route. This should be better for SEO and discovery.
2026-06-29 09:57:40 -04:00

19 lines
566 B
Ruby
Vendored

# frozen_string_literal: true
module TopMenu
def self.choices
base = %w[latest new unseen top categories read posted bookmarks hot]
begin
base << "unread" unless UpcomingChanges.enabled?(:enable_unified_new)
rescue ArgumentError
# During initial settings load, the enable_unified_new setting may not
# be registered yet. Default to including unread in that case.
base << "unread"
end
base
end
def self.crawler_homepage_choices
choices & (Discourse.anonymous_filters.map(&:to_s) + %w[new categories])
end
end