Last active
August 29, 2015 14:15
-
-
Save gfmurphy/d408da3f91b17c266a0e to your computer and use it in GitHub Desktop.
Noindex deal criteria - i.e. instruct search engines to ignore deals (and remove from index) and *not* publish in xml sitemap.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Deal types currently included in xml sitemap | |
# * "LocalDeal", "EscapesDeal", "AtHomeDeal", "FamiliesDeal" | |
# * live event deals are included | |
# URLs are generated with LS::Routing | |
# * Need to support a mobile version of the url for alternate content and mobile sitemap in near future. | |
def search_engine_ignore?(deal) | |
deal.exclusive? || deal.boomerang? || !deal.active? | |
end | |
# this logic expands to | |
def search_engine_ignore?(deal) | |
# deal.exlusive? - bitfield in deals db. name defined in LS::Deals | |
# deal.boomerang? - DealEvergreenPreferece is associated to Deal as has_one in deals db. | |
# deal.active? - current time is within the overall deal runtime AND all options are available for purchase and !sold_out | |
deal.exclusive? || deal.deal_evergreen_preference.present? | |
|| !(((!!(deal.offer_starts_at && deal.offer_ends_at)) && deal.offer_starts_at <= Time.current && Time.current < deal.offer_ends_at) && !(deal.options.select(&:available_for_purchase).all?(&:sold_out?))) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You might want to check for TZs?!