(function () {
function run() {
try {
var ROOT = 'https://www.nationaljewish.org';
// Slug → display name conversion
var SLUG_OVERRIDES = {
// Topic-level slugs whose default title-casing looks wrong
'asthma-breathing': 'Asthma & Breathing',
'avoid-treat-insect-stings': 'Avoid & Treat Insect Stings',
'eczema-atopic-dermatitis': 'Eczema & Atopic Dermatitis',
'espanol': 'Español',
'kids-health': "Kids' Health",
'living-with-a-work-related-condition': 'Living with a Work-Related Condition',
'living-with-interstitial-lung-disease-ild': 'Living with Interstitial Lung Disease (ILD)',
'living-with-ipf': 'Living with IPF',
'living-with-pulmonary-hypertension-ph': 'Living with Pulmonary Hypertension (PH)',
'living-with-sarcoidosis': 'Living with Sarcoidosis',
'multimedia': 'Multimedia',
'smoking-vaping': 'Smoking & Vaping',
'what-is-primary-immunodeficiency': 'What Is Primary Immunodeficiency'
};
// Per-word acronym uppercase rules (applied when default title-casing fires)
var ACRONYMS = {
'ada': 'ADA', 'afib': 'AFib', 'ai': 'AI', 'als': 'ALS', 'ards': 'ARDS',
'cad': 'CAD', 'copd': 'COPD', 'cpap': 'CPAP', 'eia': 'EIA',
'fpies': 'FPIES', 'gerd': 'GERD', 'ibd': 'IBD', 'ild': 'ILD',
'ipf': 'IPF', 'mrsa': 'MRSA', 'ntm': 'NTM', 'oas': 'OAS',
'ph': 'PH', 'rsv': 'RSV', 'vcd': 'VCD'
};
var SMALL_WORDS = ['a','an','and','at','by','for','in','of','on','or','the','to','with','as','but','from'];
function prettifySlug(slug) {
if (!slug) return '';
var lower = slug.toLowerCase();
if (SLUG_OVERRIDES[lower]) return SLUG_OVERRIDES[lower];
var words = lower.split('-');
return words.map(function (w, i) {
if (!w) return w;
if (ACRONYMS[w]) return ACRONYMS[w];
if (i > 0 && SMALL_WORDS.indexOf(w) !== -1) return w;
return w.charAt(0).toUpperCase() + w.slice(1);
}).join(' ');
}
var RULES = [
{
name: 'conditions',
match: /^\/conditions\/[^\/]+\/?$/i,
trail: [
{ name: 'Conditions', path: '/conditions' }
],
excludedSlugs: [
'interstitial-lung-disease-ild-center',
'interstitial-lung-disease-ild',
'ild-pf'
]
},
{
name: 'doctors',
match: /^\/doctors-departments\/doctors\/[^\/]+\/?$/i,
trail: [
{ name: 'Doctors', path: '/doctors-departments/doctors' }
],
excludedSlugs: []
},
{
name: 'health-programs',
match: /^\/health-programs\/[^\/]+\/?$/i,
trail: [
{ name: 'Health Programs', path: '/health-programs' }
],
excludedSlugs: []
},
{
name: 'health-information',
// 3, 4, or 5 segments total: /education/health-information/[/[/]]
match: /^\/education\/health-information\/[^\/]+(?:\/[^\/]+){0,2}\/?$/i,
buildTrail: function (path) {
var trail = [
{ name: 'Health Information', path: '/education/health-information' }
];
var segments = path.replace(/\/$/, '').split('/').filter(Boolean);
// segments: ["education","health-information",,[],[]]
// Intermediate breadcrumbs = everything between health-information and the leaf
var intermediate = segments.slice(2, -1);
var acc = '/education/health-information';
for (var i = 0; i < intermediate.length; i++) {
var slug = intermediate[i].toLowerCase();
acc += '/' + slug;
trail.push({ name: prettifySlug(slug), path: acc });
}
return trail;
},
excludedSlugs: []
}
];
var path = location.pathname;
var rule = null;
for (var i = 0; i < RULES.length; i++) {
if (RULES[i].match.test(path)) { rule = RULES[i]; break; }
}
if (!rule) return;
var leafSlug = path.replace(/\/$/, '').split('/').pop().toLowerCase();
if (rule.excludedSlugs.indexOf(leafSlug) !== -1) return;
// Idempotency: skip if a BreadcrumbList already exists on the page
// (a page-level static block, a prior run, or template-rendered schema)
if (document.querySelector('script[data-njh-breadcrumb]')) return;
var ldScripts = document.querySelectorAll('script[type="application/ld+json"]');
for (var k = 0; k < ldScripts.length; k++) {
if (/"@type"\s*:\s*\[?[^\]}]*"BreadcrumbList"/.test(ldScripts[k].textContent || '')) return;
}
var canonicalEl = document.querySelector('link[rel="canonical"]');
var pageUrl = canonicalEl && canonicalEl.href ? canonicalEl.href : location.href.split(/[?#]/)[0];
var rawTitle = (document.title || '').trim();
var pageName = rawTitle.replace(/\s*[|\-–—]\s*National Jewish Health.*$/i, '').trim();
if (!pageName) return;
var items = [{
"@type": "ListItem",
"position": 1,
"name": "Home",
"item": ROOT + '/'
}];
var trail = rule.buildTrail ? rule.buildTrail(path) : rule.trail;
for (var j = 0; j < trail.length; j++) {
items.push({
"@type": "ListItem",
"position": items.length + 1,
"name": trail[j].name,
"item": ROOT + trail[j].path
});
}
items.push({
"@type": "ListItem",
"position": items.length + 1,
"name": pageName,
"item": pageUrl
});
var ld = {
"@context": "https://schema.org",
"@type": "BreadcrumbList",
"itemListElement": items
};
var s = document.createElement('script');
s.type = 'application/ld+json';
s.setAttribute('data-njh-breadcrumb', rule.name);
s.textContent = JSON.stringify(ld);
document.head.appendChild(s);
} catch (e) {
// Silently fail
}
}
// Wait until the full document (including page-level JSON-LD) has been parsed
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', run);
} else {
run();
}
})();
Skip to content