Skip to content

Commit

Permalink
Featured Medium post should be most recent post (#366)
Browse files Browse the repository at this point in the history
* #365 - on load, fetch latest medium posts and display on landing page

* refactor to remove jq dependency

* handle fallback link text
  • Loading branch information
austinlparker authored and lucperkins committed Nov 8, 2018
1 parent 267db9c commit 95a233e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions themes/tracer/layouts/partials/home/cncf.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
<img src="/img/cncf-logo.png" alt="">
</div>
</section>

19 changes: 16 additions & 3 deletions themes/tracer/layouts/partials/home/hero.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,23 @@ <h2 class="dark-blue">Libraries available in {{ len $languages }} languages</h2>
</p>
</div>
{{- with $hero.update -}}
<div class="update">
<a href="{{ .url }}" target="_blank">
{{ .title }}
<h4>The latest from our blog:</h4>
<div id="update" class="update">
<a href="" target="_blank">
</a>
<script type="text/javascript">
fetch('https://api.rss2json.com/v1/api.json?rss_url=https%3A%2F%2Fmedium.com%2Ffeed%2Fopentracing')
.then(function(res) {
res.json().then(function(data) {
let item = data.items[0];
let content = `<a href="${item.link}" target="_blank">${item.title}</a>`;
document.getElementById('update').innerHTML = content;
});
}).catch(function() {
let content = `<a href="https://medium.com/opentracing" target="_blank">OpenTracing on Medium</a>`
document.getElementById('update').innerHTML = content;
});
</script>
</div>
{{- end -}}
</section>
Expand Down

0 comments on commit 95a233e

Please sign in to comment.