Exclude listing pages from search

This commit is contained in:
Jake Howard 2023-12-25 22:10:17 +00:00
parent 1276d54972
commit b13fe49664
Signed by: jake
GPG Key ID: 57AFB45680EDD477
1 changed files with 5 additions and 2 deletions

View File

@ -9,7 +9,7 @@ from wagtail.contrib.routable_page.models import RoutablePageMixin, route
from wagtail.models import Page
from wagtail.search.utils import parse_query_string
from website.common.models import BaseContentPage
from website.common.models import BaseContentPage, BaseListingPage
from website.common.utils import get_page_models
from .serializers import MIN_SEARCH_LENGTH, SearchParamsSerializer
@ -22,7 +22,10 @@ class SearchPage(RoutablePageMixin, BaseContentPage):
PAGE_SIZE = 12
# Exclude singleton pages from search results
EXCLUDED_PAGE_TYPES = {page for page in get_page_models() if page.max_count == 1}
EXCLUDED_PAGE_TYPES = {
*(page for page in get_page_models() if page.max_count == 1),
BaseListingPage,
}
@cached_property
def show_reading_time(self) -> bool: