front page improvements
This commit is contained in:
@@ -92,12 +92,6 @@
|
|||||||
<li class="grid_5">
|
<li class="grid_5">
|
||||||
<p class="midden">and more</p>
|
<p class="midden">and more</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_5">
|
|
||||||
<div class="midden">
|
|
||||||
<img src="/static/img/horizontal_line.png"
|
|
||||||
alt="horizontal line">
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<ul class="main-content" id="id_blogs">
|
<ul class="main-content" id="id_blogs">
|
||||||
</ul>
|
</ul>
|
||||||
@@ -158,17 +152,25 @@ $( document ).ready(function() {
|
|||||||
console.log('loading script');
|
console.log('loading script');
|
||||||
$.getJSON(window.location.protocol + '//'+window.location.host + '/getblogs', function(data) {
|
$.getJSON(window.location.protocol + '//'+window.location.host + '/getblogs', function(data) {
|
||||||
var html = '';
|
var html = '';
|
||||||
console.log(data);
|
if (data.length != 0) {
|
||||||
|
html += '<li class="grid_5"><div class="midden"><img src="/static/img/horizontal_line.png" alt="horizontal line"></div></li> '
|
||||||
|
html += '<li class="grid_5"><h2 class="midden">Recent articles on the Analytics blog</h2></li>';
|
||||||
|
html += '<li></li>';
|
||||||
|
};
|
||||||
$.each(data, function(key, blog) {
|
$.each(data, function(key, blog) {
|
||||||
console.log(blog.title);
|
console.log(blog.title);
|
||||||
html += '<li class="frontitem">';
|
html += '<li class="frontitem">';
|
||||||
|
html += '<a style="text-decoration: none; color: black;" href="'+blog.link+'">';
|
||||||
html += '<h3 class="midden">'+blog.title+'</h3>';
|
html += '<h3 class="midden">'+blog.title+'</h3>';
|
||||||
html += '<a href="'+blog.link+'">';
|
|
||||||
html += '<p class="midden"><img src="'+blog.image+'" height=150px;></p>';
|
html += '<p class="midden"><img src="'+blog.image+'" height=150px;></p>';
|
||||||
html += '</a>';
|
html += '<p>'+blog.excerpt+'</p>';
|
||||||
html += blog.excerpt+'</li>';
|
html += '</a>';
|
||||||
$("#id_blogs").html(html);
|
html += '</li>';
|
||||||
});
|
});
|
||||||
|
if (data.length != 0) {
|
||||||
|
html += '<li></li>';
|
||||||
|
};
|
||||||
|
$("#id_blogs").html(html);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -672,7 +672,7 @@ def get_blog_posts(request):
|
|||||||
blogposts = []
|
blogposts = []
|
||||||
|
|
||||||
|
|
||||||
for postdata in blogs_json[0:5]:
|
for postdata in blogs_json[0:3]:
|
||||||
try:
|
try:
|
||||||
featuredmedia = postdata['featured_media']
|
featuredmedia = postdata['featured_media']
|
||||||
url = 'https://analytics.rowsandall.com/wp-json/wp/v2/media/%d' % featuredmedia
|
url = 'https://analytics.rowsandall.com/wp-json/wp/v2/media/%d' % featuredmedia
|
||||||
@@ -713,14 +713,6 @@ def get_blog_posts(request):
|
|||||||
blogposts.append(thedict)
|
blogposts.append(thedict)
|
||||||
|
|
||||||
return JSONResponse(blogposts)
|
return JSONResponse(blogposts)
|
||||||
# html = render_to_string('frontpageblogs.html',
|
|
||||||
# {
|
|
||||||
# 'blogposts':blogposts,
|
|
||||||
# }
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
# return JSONResponse({'html':html})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user