Skip to content

Commit

Permalink
stop unpublished and draft pages from being indexed
Browse files Browse the repository at this point in the history
  • Loading branch information
Ross-Clark committed Jul 16, 2024
1 parent 6f8172c commit d196f99
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions streamfieldindex/indexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ def index_page(page):
# Clear the index for this specific page
IndexEntry.objects.filter(page__id=page.id).delete()

for field in page._meta.fields:
if not isinstance(field, StreamField):
# We are only interested in streamfields. Skip over non-streamfield fields
continue
if page.live: # we dont want to index any draft/unpublished pages
for field in page._meta.fields:
if not isinstance(field, StreamField):
# We are only interested in streamfields. Skip over non-streamfield fields
continue

index_field(field, page)
index_field(field, page)


def index_field(field, page):
Expand Down

0 comments on commit d196f99

Please sign in to comment.