diff --git a/best-cigars-guide/scripts/scripts.js b/best-cigars-guide/scripts/scripts.js index a6a9989..777c802 100644 --- a/best-cigars-guide/scripts/scripts.js +++ b/best-cigars-guide/scripts/scripts.js @@ -214,12 +214,25 @@ export function isInternal(path) { } } +/** + * Add hreflang link attribute to head + */ +function addHreflang() { + const el = document.createElement('link'); + el.rel = 'alternate'; + el.hreflang = 'en'; + el.href = window.location.href; + + document.head.appendChild(el); +} + /** * Loads everything needed to get to LCP. * @param {Element} doc The container element */ async function loadEager(doc) { document.documentElement.lang = 'en'; + addHreflang(); decorateTemplateAndTheme(); const main = doc.querySelector('main'); if (main) {