diff --git a/layouts/partials/ethmarks-components-js.html b/assets/js/ethmarks-components.js similarity index 54% rename from layouts/partials/ethmarks-components-js.html rename to assets/js/ethmarks-components.js index 4c6de4c8..bfc7a96f 100644 --- a/layouts/partials/ethmarks-components-js.html +++ b/assets/js/ethmarks-components.js @@ -1,19 +1,21 @@ -{{- $header := partial "header.html" . | jsonify -}} -{{- $footer := partial "footer.html" . | jsonify -}} -{{- $js := printf `// Ethmarks Web Components -// Generated automatically from Hugo partials +// Ethmarks Web Components class EthmarksHeader extends HTMLElement { connectedCallback() { - this.innerHTML = %s; + this.innerHTML = ` +
+ Ethan Marks + +
`; const activeLink = this.getAttribute('active'); if (activeLink) { - // Remove any existing active classes - const navLinks = this.querySelectorAll('nav a'); - navLinks.forEach(link => link.classList.remove('active')); - - // Add active class to the specified link by ID const targetLink = this.querySelector('#nav-' + activeLink.toLowerCase()); if (targetLink) { targetLink.classList.add('active'); @@ -24,7 +26,16 @@ class EthmarksFooter extends HTMLElement { connectedCallback() { - this.innerHTML = %s; + this.innerHTML = ` + `; const sourceLink = this.getAttribute('source'); if (sourceLink) { @@ -64,6 +75,3 @@ // Register the custom elements customElements.define('ethmarks-header', EthmarksHeader); customElements.define('ethmarks-footer', EthmarksFooter); -` $header $footer -}} -{{- $resource := resources.FromString "js/ethmarks-components.js" $js -}} -{{- $resource.Publish -}} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 3730c410..bd5ebd79 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -2,7 +2,7 @@ Website Source - Ethan Marks, ©2025 + Ethan Marks, ©2025 Contact diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 9a472e4d..0e354c67 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,10 +1,10 @@
- Ethan Marks + Ethan Marks
diff --git a/layouts/partials/publish.html b/layouts/partials/publish.html index e665cf99..fc4439cc 100644 --- a/layouts/partials/publish.html +++ b/layouts/partials/publish.html @@ -1,3 +1,3 @@ {{ partial "publish-media.html" . }} {{ partial "publish-scss.html" . }} -{{ partial "ethmarks-components-js.html" . }} +{{ (resources.Get "js/ethmarks-components.js").Publish }}