image url fixed
This commit was merged in pull request #15.
This commit is contained in:
@@ -17,7 +17,7 @@ function BlogHomeOne() {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Blogs />
|
<Blogs pathname='/' />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -2,12 +2,11 @@ import React, { useEffect, useState } from 'react';
|
|||||||
import blogOne from '../../assets/images/blog/1.jpg';
|
import blogOne from '../../assets/images/blog/1.jpg';
|
||||||
import BlogData from '../../Services/BlogData';
|
import BlogData from '../../Services/BlogData';
|
||||||
|
|
||||||
function Blogs() {
|
function Blogs({pathname}) {
|
||||||
const [blogs, setBlogs] = useState([])
|
const [blogs, setBlogs] = useState([])
|
||||||
|
|
||||||
useEffect(()=>{
|
useEffect(()=>{
|
||||||
BlogData().then(res => {
|
BlogData().then(res => {
|
||||||
// console.log('TESTING',res)
|
|
||||||
setBlogs(res.data)
|
setBlogs(res.data)
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.log('Error loading blogdata', err)
|
console.log('Error loading blogdata', err)
|
||||||
@@ -17,14 +16,14 @@ function Blogs() {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
{ pathname == '/' ? // ON HOME PAGE LIMIT TO SIX(6) BLOGS
|
||||||
|
blogs?.blogdata?.map((i, index)=> {
|
||||||
{
|
|
||||||
blogs?.blogdata?.map(i => {
|
|
||||||
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
||||||
var postDt = new Date(i.post_date).toLocaleDateString("en-US", options);
|
var postDt = new Date(i.post_date).toLocaleDateString("en-US", options);
|
||||||
var blgImg = i.meta_value != null ? `${blogs.image_url}/${i.meta_value}` : blogOne;
|
var blgImg = i.meta_value != null ? `${blogs?.blogconfig?.media_url}/${i.meta_value}` : blogOne;
|
||||||
return (<div key={i.id} className="col-lg-4 col-md-6">
|
if(index < 6){
|
||||||
|
return (
|
||||||
|
<div key={i.id} className="col-lg-4 col-md-6">
|
||||||
<div
|
<div
|
||||||
className="appie-blog-item mt-30 wow animated fadeInUp"
|
className="appie-blog-item mt-30 wow animated fadeInUp"
|
||||||
data-wow-duration="3000ms"
|
data-wow-duration="3000ms"
|
||||||
@@ -49,14 +48,45 @@ function Blogs() {
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>);
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
: // ON OTHER PAGES SHOW ALL BLOG
|
||||||
|
blogs?.blogdata?.map((i, index)=> {
|
||||||
|
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' };
|
||||||
|
var postDt = new Date(i.post_date).toLocaleDateString("en-US", options);
|
||||||
|
var blgImg = i.meta_value != null ? `${blogs?.blogconfig?.media_url}/${i.meta_value}` : blogOne;
|
||||||
|
return (
|
||||||
|
<div key={i.id} className="col-lg-4 col-md-6">
|
||||||
|
<div
|
||||||
|
className="appie-blog-item mt-30 wow animated fadeInUp"
|
||||||
|
data-wow-duration="3000ms"
|
||||||
|
data-wow-delay="200ms"
|
||||||
|
>
|
||||||
|
<div className="thumb">
|
||||||
|
<img src={blgImg} alt={i.post_title} />
|
||||||
|
</div>
|
||||||
|
<div className="content">
|
||||||
|
<div className="blog-meta">
|
||||||
|
<ul>
|
||||||
|
<li>{postDt}</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<h3 className="title">
|
||||||
|
<a href={i.guid}>
|
||||||
|
{i.post_title}
|
||||||
|
</a>
|
||||||
|
</h3>
|
||||||
|
<a href={i.guid}>
|
||||||
|
Learn More <i className="fal fa-arrow-right" />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user