Complete the code to set the HTTP status for an out-of-stock page.
response.status_code = [1]The correct HTTP status code for a page that is not found or out of stock is 404. This tells search engines the page is missing.
Complete the meta tag to tell search engines not to index an out-of-stock page.
<meta name="robots" content="[1]">
Using noindex, nofollow tells search engines not to index the page and not to follow links on it, which is suitable for out-of-stock pages.
Fix the error in the canonical link tag for an out-of-stock product page.
<link rel="canonical" href="[1]">
The canonical URL should point to a valid, in-stock product or category page to avoid duplicate content issues. Using the homepage URL is a safe fallback for out-of-stock pages.
Fill both blanks to create a redirect for out-of-stock products to a category page.
if product.stock == 0: return redirect('[1]', code=[2])
Redirecting out-of-stock products to a relevant category page with a 301 status code tells search engines the redirect is permanent.
Fill all three blanks to create a JSON-LD structured data snippet indicating product availability.
{
"@context": "https://schema.org/",
"@type": "Product",
"name": "[1]",
"availability": "[2]",
"url": "[3]"
}This JSON-LD snippet correctly marks the product name, shows it is out of stock, and provides the product URL for search engines.