aboutsummaryrefslogtreecommitdiff
path: root/blog
diff options
context:
space:
mode:
authorBobby <[email protected]>2023-05-27 01:00:09 -0400
committerBobby <[email protected]>2023-05-27 01:00:09 -0400
commit1fb8d9590f286112f790bcd4e29fcfece22c7fb3 (patch)
tree14383e7a89f63e511ce4d07e78705e9c2435f8bb /blog
parent9cbdfa382757c263974a4c3bc0238fed03f2cce0 (diff)
downloadthatcomputerscientist-1fb8d9590f286112f790bcd4e29fcfece22c7fb3.tar.xz
thatcomputerscientist-1fb8d9590f286112f790bcd4e29fcfece22c7fb3.zip
Update Meta Values in Post
Diffstat (limited to 'blog')
-rw-r--r--blog/views.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/blog/views.py b/blog/views.py
index 4c10af31..0c21f9b6 100644
--- a/blog/views.py
+++ b/blog/views.py
@@ -136,6 +136,10 @@ def post(request, slug):
comment.processed_body = comment_processor(comment.body)
if post.is_public:
+ # modify request.meta description (only text) and image
+ request.meta['description'] = BeautifulSoup(first_paragraph, 'html.parser').get_text()
+ request.meta['image'] = 'https://thatcomputerscientist.com/ignis/post_image/720/' + str(post.id) + '.gif'
+
return render(request, 'blog/post.html', {'title': post.title, 'post': post, 'tags': tags, 'comments': comments})
else:
if request.user.is_authenticated and request.user.is_superuser or request.user.is_staff: