diff --git a/exampleSite/assets/author.jpg b/exampleSite/assets/img/author.jpg similarity index 100% rename from exampleSite/assets/author.jpg rename to exampleSite/assets/img/author.jpg diff --git a/exampleSite/assets/logo.jpg b/exampleSite/assets/img/logo.jpg similarity index 100% rename from exampleSite/assets/logo.jpg rename to exampleSite/assets/img/logo.jpg diff --git a/exampleSite/assets/js/home.js b/exampleSite/assets/js/home.js new file mode 100644 index 00000000..37210349 --- /dev/null +++ b/exampleSite/assets/js/home.js @@ -0,0 +1,27 @@ +function switchHomeLayout() { + const pageDiv = document.getElementById("page"); + const profileDiv = document.getElementById("profile"); + const layoutCode = document.querySelectorAll("code[id=layout]"); + if (pageDiv.style.display === "none") { + pageDiv.style.display = "block"; + profileDiv.style.display = "none"; + layoutCode.forEach(function (el) { + el.innerText = "page"; + }); + } else { + pageDiv.style.display = "none"; + profileDiv.style.display = "block"; + layoutCode.forEach(function (el) { + el.innerText = "profile"; + }); + } +} + +window.addEventListener("DOMContentLoaded", (event) => { + document.querySelectorAll("#switch-layout-button").forEach((button) => + button.addEventListener("click", function (e) { + e.preventDefault(); + switchHomeLayout(); + }) + ); +}); diff --git a/exampleSite/config/_default/languages.en.toml b/exampleSite/config/_default/languages.en.toml index e8f977a8..b7c45ab0 100644 --- a/exampleSite/config/_default/languages.en.toml +++ b/exampleSite/config/_default/languages.en.toml @@ -13,7 +13,7 @@ dateFormat = "2 January 2006" [author] name = "Congo" - image = "author.jpg" + image = "img/author.jpg" # headline = "" bio = "This is an example author bio, and although there's a stock photo of a dog here, this article was actually created by a human. :dog:" links = [ diff --git a/exampleSite/content/_index.md b/exampleSite/content/_index.md index 89159701..24b50cd2 100755 --- a/exampleSite/content/_index.md +++ b/exampleSite/content/_index.md @@ -16,8 +16,8 @@ This is a demo site built entirely using Congo. It also contains a complete set This is a demo of the page layout. diff --git a/exampleSite/layouts/partials/home/custom.html b/exampleSite/layouts/partials/home/custom.html index b301686a..960ff02e 100644 --- a/exampleSite/layouts/partials/home/custom.html +++ b/exampleSite/layouts/partials/home/custom.html @@ -1,27 +1,8 @@ +{{ $jsHome := resources.Get "js/home.js" | resources.Minify | resources.Fingerprint "sha512" }}
{{ partial "partials/home/page.html" . }}
- - +