diff --git a/blog.html b/blog.html index e6a5ae3..624c7a1 100644 --- a/blog.html +++ b/blog.html @@ -10,14 +10,38 @@ integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous" /> - - - - - - - - + + + + + + + + - +

All Blog Posts

- + -
@@ -148,38 +179,31 @@

All Blog Posts

  • Home
  • Services
  • Case Studies
  • Who We Are
  • -
  • - Insight -
  • @@ -192,22 +216,18 @@

    All Blog Posts

    @@ -216,22 +303,18 @@

    Submit a Project Proposal

    @@ -276,22 +284,18 @@
    Image Gallery
    - + - + document.getElementById("loadingSpinner").style.display = + "block"; + try { + const response = await axios.get( + `https://be-company-profile-pieter.vercel.app/api/posts/${postId}` + ); + const post = response.data.data; + document.getElementById( + "heroThumbnail" + ).style.backgroundImage = `url(${ + post.thumbnail || + "assets/img/illustrations/sample_main.jpg" + })`; + document.getElementById("mainImage").src = post.thumbnail; + document.getElementById("productTitle").innerText = + post.title || "Blog Title"; + document.getElementById("productDescription").innerText = + post.content || "Blog description goes here..."; + document.getElementById( + "productAuthorMeta" + ).innerText = `Author: ${post.author || "Unknown"}`; + document.getElementById("productTags").innerText = `Tags: ${ + Array.isArray(post.tags) + ? post.tags.join(", ") + : "No tags available" + }`; + + const images = [ + post.thumbnail, + post.images1, + post.images2, + post.images3, + post.images4, + post.images5, + ].filter(Boolean); + const imageDetailsContainer = document.getElementById( + "imageDetailsContainer" + ); + if (images.length > 0) { + imageDetailsContainer.innerHTML = images + .map( + (img) => + `Detail Image` + ) + .join(""); + } else { + imageDetailsContainer.innerHTML = `

    No additional images available.

    `; + } + + document.getElementById("loadingSpinner").style.display = + "none"; + document.getElementById("content").style.display = "block"; + } catch (error) { + console.error("Error fetching blog details:", error); + document.getElementById("productTitle").innerText = + "Failed to load blog details. Please try again later."; + document.getElementById("loadingSpinner").style.display = + "none"; + } + } + + document.addEventListener("DOMContentLoaded", fetchBlogDetail); + -