aboutsummaryrefslogtreecommitdiff
path: root/middleware/globalmetamiddleware.py
blob: f5e00555e2cf5bc37ff9c8d95d6f2d000a799a8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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": "Home",
            "description": "Welcome to the home of Shifoo. This is my personal website where I share all of my thoughts, ideas, and experiences.",
            "image": "https://shi.foo/static/images/favicons/android-chrome-512x512.png",
            "url": "{}://{}{}".format(request.scheme, request.get_host(), request.path),
            # Robots Meta Tags
            "robots": "index, follow",
        }

        response = self.get_response(request)

        return response