-
Notifications
You must be signed in to change notification settings - Fork 374
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #357 from PrajaktaPatil05/main
blog page added #286
- Loading branch information
Showing
3 changed files
with
377 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const blogs = [ | ||
{ | ||
title: "Blog Title 1", | ||
description: "Short description of Blog 1.", | ||
image: "../assets/images/blog1.jpg", // Path to your image | ||
link: "/pages/blog1.html", // Link to the full blog post | ||
}, | ||
{ | ||
title: "Blog Title 2", | ||
description: "Short description of Blog 2.", | ||
image: "../assets/images/blog2.jpg", // Path to your image | ||
link: "/pages/blog2.html", // Link to the full blog post | ||
}, | ||
// Add more blog entries as needed | ||
]; | ||
|
||
// Function to display blogs | ||
function displayBlogs() { | ||
const blogList = document.querySelector(".grid-list"); | ||
blogs.forEach(blog => { | ||
const blogCard = document.createElement("li"); | ||
blogCard.classList.add("blog-card"); | ||
|
||
blogCard.innerHTML = ` | ||
<a href="${blog.link}"> | ||
<img src="${blog.image}" alt="${blog.title}" /> | ||
<h3>${blog.title}</h3> | ||
<p>${blog.description}</p> | ||
</a> | ||
`; | ||
|
||
blogList.appendChild(blogCard); | ||
}); | ||
} | ||
|
||
// Call the function to display blogs when the page loads | ||
window.onload = displayBlogs; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.