Skip to content

Commit

Permalink
Merge pull request getpelican#563 from schtobia/for_upstream
Browse files Browse the repository at this point in the history
Just Read: Extended metadata block for non-article pages
  • Loading branch information
justinmayer authored Oct 18, 2018
2 parents d06e44e + 2ba901d commit f171735
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 21 deletions.
35 changes: 20 additions & 15 deletions Just-Read/templates/article.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,31 @@
<div class="post wrapper">
<h1>{{ article.title }}</h1>
{{ article.content }}

<a href="https://twitter.com/share" class="twitter-share-button" data-via="{{ TWITTER_USERNAME }}" data-lang="en" data-size="large" data-related="{{ TWITTER_USERNAME }}">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>

<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
{% if DISQUS_SITENAME %}
<div class="comments">
<h2>Comments !</h2>
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_identifier = "{{ article.url }}";
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'https://{{ DISQUS_SITENAME }}.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<h2>Comments !</h2>
<div id="disqus_thread"></div>
<script>
var disqus_config = function () {
this.page.url = "{{ SITEURL }}/{{ article.url }}";
this.page.identifier = "{{ article.slug }}";
this.page.title = "{{ article.title }}";
};
(function() {
var d = document,
s = d.createElement('script');
s.src = 'https://{{ DISQUS_SITENAME }}.disqus.com/embed.js';
s.setAttribute('data-timestamp', +new Date());
(d.head || d.body).appendChild(s);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
</div>
{% endif %}
{% endif %}
</div>

{% include 'metadata.html' %}
</article>
</div>
Expand Down
38 changes: 32 additions & 6 deletions Just-Read/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,24 @@
<meta name="author" content="{{ AUTHOR }}" />
<meta name="copyright" content="{{ AUTHOR }}" />
{% endif %}

<meta property="og:site_name" content="{{SITENAME}}" />

{% if GOOGLE_PLUS_PROFILE_URL %}
<link rel="author" href={{GOOGLE_PLUS_PROFILE_URL}} />
{% endif %}
{%if TWITTER_USERNAME %}
<meta name="twitter:site" content="@{{TWITTER_USERNAME}}" />
<meta name="twitter:creator" content="@{{TWITTER_USERNAME}}" />
{% endif %}

{%if article %}
<meta name="twitter:card" content="summary" />
{%if article %}
<meta name="twitter:title" content="{{article.title}}" />
<meta name="date" content="{{article.date}}" />
<meta property="og:type" content="article" />
<meta property="og:locale" content="{{article.lang}}" />
<meta property="og:published_time" content="{{article.date}}" />
<meta property="og:title" content="{{article.title}}" />
<meta property="og:url" content="{{SITEURL}}/{{ article.url }}" />
{% if article.featured_image %}
{% if article.featured_image %}
<meta property="og:image" content="{{ article.featured_image }}" />
{% endif %}
{%if DESCRIPTION %}
Expand All @@ -47,8 +44,37 @@
{%if FACEBOOK_PROFILE_URL %}
<meta property="article:author" content="{{FACEBOOK_PROFILE_URL}}" />
{% endif %}
{% elif page %}
<meta name="twitter:title" content="{{page.title}}" />
<meta name="date" content="{{page.date}}" />
<meta property="og:type" content="website" />
<meta property="og:locale" content="{{page.lang}}" />
<meta property="og:published_time" content="{{page.date}}" />
<meta property="og:title" content="{{page.title}}" />
<meta property="og:url" content="{{SITEURL}}/{{ page.url }}" />
{% if page.featured_image %}
<meta property="og:image" content="{{ page.featured_image }}" />
{% endif %}
{%if DESCRIPTION %}
<meta property="og:description" content="{{DESCRIPTION}} " />
<meta name="description" content="{{DESCRIPTION}}" />
{%else %}
<meta property="og:description" content="{{page.summary|striptags}}" />
<meta name="description" content="{{page.summary|striptags}}" />
{% endif %}
{% else %}
<meta name="twitter:title" content="{{SITENAME}}" />
<meta property="og:type" content="website" />
{% if DEFAULT_LANG %}
<meta property="og:locale" content="{{DEFAULT_LANG}}" />
{% endif %}
<meta property="og:title" content="{{SITENAME}}" />
<meta property="og:url" content="{{SITEURL}}/{{ output_file }}" />
{%if DESCRIPTION %}
<meta property="og:description" content="{{DESCRIPTION}} " />
<meta name="description" content="{{DESCRIPTION}}" />
{% endif %}
{% endif %}

<meta name="HandheldFriendly" content="True" />
<meta name="MobileOptimized" content="320" />
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0" />
Expand Down

0 comments on commit f171735

Please sign in to comment.