Skip to content

Commit

Permalink
Update blog.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisgoddard authored Nov 6, 2023
1 parent 5810d84 commit e093e0b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions _scripts/pages/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import jQuery from '~/lib/jquery'
jQuery.then(($) => {
$(function () {
$.getJSON('https://blog.elementary.io/feed/updates.json', function (data) {
var blogContents = ''
let blogContents = ''
blogContents += '<div class="blog-container">'
$.each(data.posts, function (n, post) {
var postContents = ''
let postContents = ''
postContents += '<a class="featured with-image" href="' + post.url + '">'
postContents += '<div class="featured-image" alt="Featured image" style="background-image: url(' + post.image + ');"></div>'
postContents += '<header>'
Expand All @@ -27,9 +27,9 @@ jQuery.then(($) => {
postContents += '<div class="author">'
postContents += '<span class="name">' + post.author.name + '</span>'
postContents += '</div>'
var dateJs = new Date(post.pubDate)
var dateOptions = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', timezone: 'UTC' }
var dateNice = dateJs.toLocaleDateString('en-US', dateOptions)
const dateJs = new Date(post.pubDate)
const dateOptions = { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', timezone: 'UTC' }
const dateNice = dateJs.toLocaleDateString('en-US', dateOptions)
postContents += '<time class="post-date" datetime="' + post.pubDate + '">' + dateNice + '</time>'
postContents += '<span class="read-time" title="Estimated read time">'
postContents += post.read_time
Expand Down

0 comments on commit e093e0b

Please sign in to comment.