From 03b1754e0a67b9912f0b498091eef06b9d03867a Mon Sep 17 00:00:00 2001 From: Timo Halbesma Date: Fri, 14 Jul 2017 00:50:17 +0200 Subject: [PATCH] Possibly fixed #36. ihavenoideawhatimdoingtho --- apps/blog/templates/blog/detail.html | 10 ++++++++- apps/blog/views.py | 3 ++- templates/base.html | 33 ++++++++++++++-------------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/apps/blog/templates/blog/detail.html b/apps/blog/templates/blog/detail.html index a2d09d5..3354939 100644 --- a/apps/blog/templates/blog/detail.html +++ b/apps/blog/templates/blog/detail.html @@ -1,7 +1,15 @@ {% extends "base.html" %} {% load static %} +{% block meta_description %}Blog by {{ post.author.affiliation }}: {{ post.title }}. {{ block.super }} {% endblock meta_description %} +{% block meta_keywords %}{% for tag in post.tags.all %}{{ tag }} {% endfor %} {{ block.super }} {% endblock meta_keywords %} +{% block meta_twitter_url %}{{ full_url }}{% endblock meta_twitter_url %} +{% block meta_twitter_title %}{{ block.super}} | {{ post.title }}{% endblock meta_twitter_title %} +{% block meta_twitter_description %}Blog by {{ post.author.affiliation }}: {{ post.title }}. {{ block.super }}{% endblock meta_twitter_description %} +{% block meta_og_url %}{{ full_url }}{% endblock meta_og_url %} +{% block meta_og_title %}{{ block.super}} | {{ post.title }}{% endblock meta_og_title %} +{% block meta_og_description %}Blog by {{ post.author.affiliation }}: {{ post.title }}. {{ block.super }} {% endblock meta_og_description %} {% block stylesheets %} {{ block.super }} {% endblock stylesheets %} -{% block title %} {{ block.super }} | Blogpost Toevoegen Geslaagd! {% endblock title %} +{% block title %} {{ block.super }} | {{ post.title }} {% endblock title %} {% block content %} diff --git a/apps/blog/views.py b/apps/blog/views.py index 19d7b16..74b4e59 100644 --- a/apps/blog/views.py +++ b/apps/blog/views.py @@ -140,9 +140,10 @@ def change_post(request, slug): def post_detail(request, slug): post = get_object_or_404(Post, slug=slug) + full_url = request.build_absolute_uri() if not post.is_published: raise Http404("Post is unpublished. First publish the blogpost, then view the blogpost on the website. ") - return render(request, "blog/detail.html", { "post": post }) + return render(request, "blog/detail.html", { "post": post, "full_url": full_url }) def update_post_counter(request, slug): diff --git a/templates/base.html b/templates/base.html index 7e48183..a1f29cd 100644 --- a/templates/base.html +++ b/templates/base.html @@ -11,33 +11,32 @@ - - - - {# Description and Keywords #} - - - + + {# Twitter #} - - - - - - - + + + + + + {# Facebok #} - - + + + + + + + + {% block title %} FairBlogs {% endblock title %} -