aboutsummaryrefslogtreecommitdiff
path: root/middleware
diff options
context:
space:
mode:
authorBobby <[email protected]>2022-12-27 07:18:19 -0500
committerBobby <[email protected]>2022-12-27 07:18:19 -0500
commit51a42e119ac6076c017dcb0a76c30989395df0c3 (patch)
treec39bd153ac33b389b25cfe0ba63c29cbe30fb3d2 /middleware
parentdde395cdd11024a014c7a3faaee52105eb1fef64 (diff)
downloadthatcomputerscientist-51a42e119ac6076c017dcb0a76c30989395df0c3.tar.xz
thatcomputerscientist-51a42e119ac6076c017dcb0a76c30989395df0c3.zip
Big Overhaul: Major Changes for Migrating to a Clean Code and Style
Diffstat (limited to 'middleware')
-rw-r--r--middleware/globalmetamiddleware.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/middleware/globalmetamiddleware.py b/middleware/globalmetamiddleware.py
new file mode 100644
index 00000000..4a98dc02
--- /dev/null
+++ b/middleware/globalmetamiddleware.py
@@ -0,0 +1,21 @@
+# Middleware to add global meta tags to the HTML head
+
+class GlobalMetaMiddleware:
+ def __init__(self, get_response):
+ self.get_response = get_response
+
+ def __call__(self, request):
+ request.meta = {
+ # Default General Meta Tags
+ 'title': 'That Computer Scientist',
+ 'description': 'Welcome to the home of That Computer Scientist. I am Kumar Priyansh. This is my personal website where I share all of my thoughts, ideas, and experiences.',
+ 'image': 'https://thatcomputerscientist.com/static/images/logo/logo.png',
+ 'url': '{}://{}{}'.format(request.scheme, request.get_host(), request.path),
+
+ # Robots Meta Tags
+ 'robots': 'index, follow',
+ }
+
+ response = self.get_response(request)
+
+ return response