mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
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.
19 lines
566 B
Ruby
Vendored
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
|