0 Stop Search Engines from Indexing Past Calendar Events Shared by Jessica Gorbett, 9 Embers 4 days ago 4.0 CMS Intermediate Past event pages can remain accessible in Rock long after an event has ended. This is often helpful for internal records and existing links, but it can also cause outdated events to appear in Google and other search results.The following Lava adds a noindex, follow robots directive when an event occurrence no longer has a future occurrence date. This allows search engines to continue following links on the page while asking them not to include the expired event page in search results.This example is written for the Calendar Event Item Occurrence Lava block, but the same approach can be adapted for other blocks and content types. Add the following code near the beginning or end of the event detail template:{% comment %}Stop Indexing When Next Occurrence is Empty{% endcomment %}{% assign nextStart = EventItemOccurrence.NextStartDateTime -%}{% if nextStart == null or nextStart == '' -%} {{ 'noindex, follow' | AddMetaTagToHead:'property','robots' }}{% endif -%}How quickly does it work?You can see the change immediately with Page Source per event. Adding noindex does not remove the page from search results immediately.The search engine must crawl the event page again before it recognizes the new directive. Previously indexed events may continue appearing in results for a period of time.Understand What the Code ChecksThis line retrieves the next scheduled occurrence: {% assign nextStart = EventItemOccurrence.NextStartDateTime -%}When the event does not have another upcoming occurrence, NextStartDateTime should be empty or null. The conditional then adds a robots meta tag to the page:{{ 'noindex, follow' | AddMetaTagToHead:'property','robots' }}The resulting page directive tells search engines:noindex: Do not include this page in search results.follow: Continue following links found on the page.The event page remains publicly accessible through its URL.