mirror of
https://github.com/kirsle/kirsle.net
synced 2024-11-06 00:49:29 +00:00
Moar Google ads
This commit is contained in:
parent
f35ec3ea62
commit
72bdec4fe8
82
www/blog/entry.inc.html
Normal file
82
www/blog/entry.inc.html
Normal file
|
@ -0,0 +1,82 @@
|
|||
{# Reusable template for showing a blog post content #}
|
||||
{% from "google-ads.inc.html" import leaderboard %}
|
||||
|
||||
{% macro blog_entry(post, from=None) %}
|
||||
|
||||
{% if from == "index" %}
|
||||
<a href="{{ url_for('blog.entry', fid=post['fid']) }}" class="blog-title-index">
|
||||
{{ post["subject"] }}
|
||||
</a><p>
|
||||
{% endif %}
|
||||
|
||||
<div class="blog-author">
|
||||
{% if post["avatar"] %}
|
||||
<img src="/static/avatars/{{ post['avatar'] }}">
|
||||
{% elif post["photo"] %}
|
||||
<img src="{{ post['photo_url'] }}/{{ post['photo'] }}">
|
||||
{% else %}
|
||||
<img src="/static/avatars/default.png">
|
||||
{% endif %}
|
||||
<br>
|
||||
|
||||
{{ post["profile"]["username"] }}
|
||||
</div>
|
||||
|
||||
<div class="blog-timestamp">
|
||||
Posted by {{ post["profile"]["name"] }}
|
||||
on <span title="{{ post['time'] }}">{{ post["pretty_time"] }}</span>
|
||||
</div>
|
||||
|
||||
{{ post["body"] | safe }}
|
||||
|
||||
<p>
|
||||
<div class="clear">
|
||||
<strong>Categories:</strong>
|
||||
{% if post["categories"]|length == 0 %}
|
||||
<a href="{{ url_for('blog.category', category=Uncategorized) }}">Uncategorized</a>{# TODO hardcoded name #}
|
||||
{% else %}
|
||||
<ul class="blog-categories">
|
||||
{% for tag in post["categories"] %}
|
||||
<li><a href="{{ url_for('blog.category', category=tag) }}">{{ tag }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
<p>
|
||||
|
||||
[
|
||||
{% if from == "index" %}
|
||||
{% if post["comments"] %}{# Allowed comments #}
|
||||
<a href="{{ url_for('blog.entry', fid=post['fid']) }}#comments">{{ post["comment_count"] }} comment{% if post["comment_count"] != 1 %}s{% endif %}</a>
|
||||
|
|
||||
<a href="{{ url_for('blog.entry', fid=post['fid']) }}#addcomment">Add comment</a>
|
||||
|
|
||||
{% endif %}
|
||||
|
||||
<a href="{{ url_for('blog.entry', fid=post['fid']) }}">Permalink</a>
|
||||
{% else %}
|
||||
<a href="{{ url_for('blog.index') }}">Blog</a>
|
||||
{% endif %}
|
||||
|
||||
{% if session["login"] %}
|
||||
|
|
||||
<a href="{{ url_for('blog.update', id=post['post_id']) }}">Edit</a>
|
||||
|
|
||||
<a href="{{ url_for('blog.delete', id=post['post_id']) }}">Delete</a>
|
||||
{% endif %}
|
||||
]
|
||||
</div>
|
||||
<p>
|
||||
|
||||
{# Show the Google ad after the first post. #}
|
||||
{% if from == "index" and post["position_index"] == 1 %}
|
||||
{{ leaderboard() }}
|
||||
{% endif %}
|
||||
|
||||
{% if from != "index" %}
|
||||
{{ include_page("comment.partial_index",
|
||||
thread="blog-"+post["post_id"]|string,
|
||||
subject=post["subject"],
|
||||
) | safe }}
|
||||
{% endif %}
|
||||
|
||||
{% endmacro %}
|
33
www/google-ads.inc.html
Normal file
33
www/google-ads.inc.html
Normal file
|
@ -0,0 +1,33 @@
|
|||
{# Google ads for Kirsle.net #}
|
||||
|
||||
{% macro nav_ads() %}
|
||||
<div style="text-align: center">
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "ca-pub-0838718168234603";
|
||||
/* Kirsle.net Nav */
|
||||
google_ad_slot = "1728209841";
|
||||
google_ad_width = 120;
|
||||
google_ad_height = 240;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
</script>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro leaderboard() %}
|
||||
<div style="text-align: center">
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "ca-pub-0838718168234603";
|
||||
/* Kirsle.net Leaderboard */
|
||||
google_ad_slot = "9251476641";
|
||||
google_ad_width = 728;
|
||||
google_ad_height = 90;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
</script>
|
||||
</div>
|
||||
{% endmacro %}
|
|
@ -12,6 +12,8 @@
|
|||
</head>
|
||||
<body>
|
||||
|
||||
{% from "google-ads.inc.html" import leaderboard, nav_ads %}
|
||||
|
||||
<div class="k-supernova"></div>
|
||||
<div class="k-kirsle" onClick="self.location='/'"></div>
|
||||
|
||||
|
@ -30,6 +32,10 @@
|
|||
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
{% if uri not in ["/", "/blog/index"] and not "/blog/category" in uri %}
|
||||
{{ leaderboard() }}
|
||||
{% endif %}
|
||||
|
||||
<div class="k-copyright">
|
||||
Copyright © 2014 Noah Petherbridge<br>
|
||||
Powered by {{ app["name"] }} v{{ app["version"] }}<br>
|
||||
|
@ -106,19 +112,7 @@
|
|||
¤ <a href="http://search.cpan.org/~kirsle">CPAN</a>
|
||||
</div>
|
||||
|
||||
<div style="text-align: center">
|
||||
<script type="text/javascript"><!--
|
||||
google_ad_client = "ca-pub-0838718168234603";
|
||||
/* Kirsle.net Nav */
|
||||
google_ad_slot = "1728209841";
|
||||
google_ad_width = 120;
|
||||
google_ad_height = 240;
|
||||
//-->
|
||||
</script>
|
||||
<script type="text/javascript"
|
||||
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
|
||||
</script>
|
||||
</div>
|
||||
{{ nav_ads() }}
|
||||
|
||||
<div class="k-section">Fan Club</div>
|
||||
<div class="k-navi">
|
||||
|
|
Loading…
Reference in New Issue
Block a user