Blog shorting updated , latest blog will show first
This commit is contained in:
parent
4d8e30a634
commit
208dfa893c
@ -15,21 +15,28 @@ const Blog = () => {
|
|||||||
pagination(".single_box_", sort, active);
|
pagination(".single_box_", sort, active);
|
||||||
let list = document.querySelectorAll(".single_box_");
|
let list = document.querySelectorAll(".single_box_");
|
||||||
setstate(getPagination(list.length, sort));
|
setstate(getPagination(list.length, sort));
|
||||||
|
window.scrollTo({
|
||||||
|
top: 0,
|
||||||
|
behavior: "smooth" // smooth scrolling effect
|
||||||
|
});
|
||||||
|
|
||||||
}, [active]);
|
}, [active]);
|
||||||
|
|
||||||
|
const sortedBlogs = [...BlogData].sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<ConsenHead title="Blogs - Web Development, SEO & Digital Marketing"
|
<ConsenHead
|
||||||
description="Discover blogs on website development, mobile apps, SEO, digital marketing, UI/UX, and graphic design with insights from MetatronCube India." />
|
title="Blog | Metatroncube"
|
||||||
|
description="Explore the latest SEO strategies for 2025. Stay ahead with insights from Metatroncube Software Solutions."
|
||||||
|
/>
|
||||||
<Layout>
|
<Layout>
|
||||||
<BlogBan pageName={"BLOG"} />
|
<BlogBan pageName={"BLOG"} />
|
||||||
<div className="blog-area style-two page">
|
<div className="blog-area style-two page">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{
|
{
|
||||||
BlogData?.map((blog) => {
|
sortedBlogs?.map((blog) => {
|
||||||
return (
|
return (
|
||||||
<div className="col-lg-4 col-md-6 single_box_" key={blog?.id}>
|
<div className="col-lg-4 col-md-6 single_box_" key={blog?.id}>
|
||||||
<div className="single-blog-box">
|
<div className="single-blog-box">
|
||||||
@ -48,12 +55,11 @@ const Blog = () => {
|
|||||||
<Link legacyBehavior href={`${blog?.slug}`}>
|
<Link legacyBehavior href={`${blog?.slug}`}>
|
||||||
<a>
|
<a>
|
||||||
{blog?.title.length > 50
|
{blog?.title.length > 50
|
||||||
? blog.title.substring(0, 40) + '...'
|
? blog.title.substring(0, 50) + '...'
|
||||||
: blog.title}
|
: blog.title}
|
||||||
</a>
|
</a>
|
||||||
</Link>
|
</Link>
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="em-blog-icon">
|
<div className="em-blog-icon">
|
||||||
<div className="em-blog-thumb">
|
<div className="em-blog-thumb">
|
||||||
|
|||||||
@ -2,6 +2,9 @@ import { BlogData } from "@/utils/constant.utils";
|
|||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
|
|
||||||
const BlogSection = () => {
|
const BlogSection = () => {
|
||||||
|
|
||||||
|
const sortedBlogs = [...BlogData].sort((a, b) => new Date(b.date) - new Date(a.date)).slice(0, 3);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="service-area new-style">
|
<div className="service-area new-style">
|
||||||
<div className="container">
|
<div className="container">
|
||||||
@ -15,7 +18,7 @@ const BlogSection = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{
|
{
|
||||||
BlogData?.slice(0, 3)?.map((blog) => {
|
sortedBlogs?.map((blog) => {
|
||||||
return (
|
return (
|
||||||
<div className="col-lg-4 col-md-6" key={blog?.id}>
|
<div className="col-lg-4 col-md-6" key={blog?.id}>
|
||||||
<div className="single-service-box">
|
<div className="single-service-box">
|
||||||
@ -26,9 +29,11 @@ const BlogSection = () => {
|
|||||||
<img src="/assets/images/home/blog/1.webp" alt={blog?.slug} />
|
<img src="/assets/images/home/blog/1.webp" alt={blog?.slug} />
|
||||||
</div> */}
|
</div> */}
|
||||||
<div className="service-content">
|
<div className="service-content">
|
||||||
<h2> {blog?.title.length > 50
|
<h2>
|
||||||
? blog.title.substring(0, 50) + '...'
|
{blog?.title.length > 50
|
||||||
: blog.title}</h2>
|
? blog.title.substring(0, 50) + '...'
|
||||||
|
: blog.title}
|
||||||
|
</h2>
|
||||||
<p>
|
<p>
|
||||||
{blog?.date}
|
{blog?.date}
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user