/** * Dynamic Noindex Injection Algorithm for SmartJobBoard * Strategically evaluates faceted navigation taxonomy pages upon client-side load. * Appends a strict noindex directive to the document head if the active job * count falls below the mathematically viable threshold for organic ranking. */ document.addEventListener("DOMContentLoaded", function() { // Define the absolute threshold for minimum acceptable job inventory const MINIMUM_JOB_THRESHOLD = 3; const currentUrl = window.location.href.toLowerCase(); // Restrict execution exclusively to faceted taxonomy and search pathways // This prevents accidental de-indexation of static content or the homepage if (currentUrl.includes('/category/') | | currentUrl.includes('/location/') | | currentUrl.includes('/search-results/')) { // Isolate standard SJB job listing DOM elements utilizing CSS selectors // The specific class nomenclature may vary slightly depending on the active SJB Theme const jobListings = document.querySelectorAll('.job-item,.listing-item, article.job'); // Evaluate the NodeList length against the defined threshold if (jobListings.length < MINIMUM_JOB_THRESHOLD) { // Instantiate a new meta HTML element const metaRobots = document.createElement('meta'); metaRobots.setAttribute('name', 'robots'); // Apply the noindex command while explicitly preserving internal link crawling metaRobots.setAttribute('content', 'noindex, follow'); // Inject the constructed node directly into the document head document.head.appendChild(metaRobots); // Output telemetry to the browser console for engineering QA purposes console.log(` Page inventory critically low (${jobListings.length} jobs detected). Client-side noindex directive successfully injected to preserve crawl budget.`); } } });