Skip to content

Commit

Permalink
Add more twitter integration
Browse files Browse the repository at this point in the history
- If the blog author's twitter ID is specified, add a small twitter
bird after the author's name
- Add the @JuliaLanguage twitter handle for the twitter site metadata
  • Loading branch information
Keno committed Sep 25, 2020
1 parent 2333495 commit 65792b4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion _layout/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ <h3>
{{isdef published}} <span style="font-weight: lighter;"> {{fill published}} </span>
|
{{end}}
{{isdef author}} <span style="font-weight: bold;">{{fill author}}</span> {{end}}
{{isdef author}} <span style="font-weight: bold;">{{fill author}}{{author_twitter}}</span> {{end}}
<!-- assumption that only one of the two is defined -->
{{isdef authors}} <span style="font-weight: bold;">{{fill authors}} </span> {{end}}
</h3>
Expand Down
1 change: 1 addition & 0 deletions _layout/meta.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="author" content="Jeff Bezanson, Stefan Karpinski, Viral Shah, Alan Edelman, et al.">
<meta name="description" content="The official website for the Julia Language. Julia is a language that is fast, dynamic, easy to use, and open source. Click here to learn more.">
<meta name="twitter:site:id" content="1237720952"> <!-- @JuliaLanguage -->
4 changes: 3 additions & 1 deletion blog/2020/09/rr-memory-magic.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
+++
authors = "Keno Fischer"
author = "Keno Fischer"
published = "24 September 2020"
title = "Remotely Debugging Faulty Memory - an rr case study"
rss = """Since the release of Julia 1.5 we've gotten lots of rr traces. This tells the story of a particularly interesting one."""
meta = [
("property", "og:image", "https://julialang.org/assets/blog/2020-09-23-rr-memory/faulty-mem.jpg"),
("name", "twitter:creator:id", "4922348584"),
("name", "twitter:card", "summary_large_image")
]
+++

Expand Down
16 changes: 16 additions & 0 deletions utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,19 @@ function hfun_redirect(url)
"""
return s
end

"""
{{author_twitter}}
"""
function hfun_author_twitter()
meta = locvar(:meta)
if meta !== nothing
for (kind, tag, value) in meta
if kind == "name" && tag == "twitter:creator:id"
return " <a href=\"https://twitter.com/intent/user?user_id=$value\"><img src=\"/assets/infra/twitter_16.png\"/></a>"
end
end
end
return ""
end

0 comments on commit 65792b4

Please sign in to comment.