Purpose
Find the property detail links contained specifically in the Featured Properties section of the Alpine South Properties portfolio page.
When to Use
Use when the caller needs property detail URLs from the Featured Properties section at /portfolio, rather than every internal link on the site.
Workflow
- Navigate directly to
https://www.alpinesouthproperties.com/portfolio. - In the same browser call, run this evaluator on the loaded page. It locates the heading whose text begins with
Featured Properties, selects its nearest meaningful section/container, and returns deduplicated same-origin detail links while excluding the portfolio page, search paths, fragments, and non-property page links:
(() => {
const clean = s => (s || '').replace(/\\s+/g, ' ').trim();
const heading = [...document.querySelectorAll('h1,h2,h3,h4,h5,h6,[role="heading"]')]
.find(el => /^Featured\\s+Properties\\b/i.test(clean(el.textContent)));
if (!heading) return {sectionFound: false, links: []};
let container = heading.closest('section, article');
if (!container) {
let node = heading.parentElement;
while (node && node !== document.body) {
const count = node.querySelectorAll('a[href]').length;
if (count > 0) { container = node; break; }
node = node.parentElement;
}
}
if (!container) return {sectionFound: true, links: []};
const links = [];
const seen = new Set();
for (const a of container.querySelectorAll('a[href]')) {
let url;
try { url = new URL(a.href, location.href); } catch (_) { continue; }
if (url.origin !== location.origin || url.hash || url.pathname === '/portfolio' || url.pathname.startsWith('/s/')) continue;
const href = url.href.replace(/\\/$/, '');
if (seen.has(href)) continue;
seen.add(href);
links.push({href: url.href, text: clean(a.textContent || a.getAttribute('aria-label') || '')});
}
return {sectionFound: true, links};
})()Site-Specific Gotchas
- The featured area must be scoped from the
Featured Propertiesheading; extracting all same-origin anchors from/portfolioalso captures navigation and unrelated page links. - A property card may expose the same detail URL through both its image and title, so deduplicate by normalized absolute URL.
- The section can use nested card containers rather than a single obvious list; the evaluator first checks semantic
section/articleancestors and then falls back to the nearest ancestor containing links. - The evaluator intentionally excludes
/s/search routes and the portfolio index; if Alpine South later introduces a dedicated property URL prefix, retain the section scoping and adjust only the exclusion rules as needed.
Expected Output
An object of the form {sectionFound: boolean, links: [{href: string, text: string}]}. links contains one absolute URL per Featured Properties property detail page, in DOM order.