fix: avoid loading analytics in localhost
This commit is contained in:
parent
453486761d
commit
672c34aa1a
7 changed files with 38 additions and 30 deletions
17
packages/helpers/lektor_helpers.py
Normal file
17
packages/helpers/lektor_helpers.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import datetime
|
||||
import os
|
||||
|
||||
from lektor.pluginsystem import Plugin
|
||||
|
||||
|
||||
class HelpersPlugin(Plugin):
|
||||
name = "helpers"
|
||||
description = "Helpers for my site"
|
||||
|
||||
def on_process_template_context(self, context, **extra):
|
||||
# Add the datetime package to the template context
|
||||
context["datetime"] = datetime
|
||||
|
||||
# Add a variable to the template context to check if the site is running in development mode
|
||||
context["is_dev"] = os.environ.get("LEKTOR_DEV") == "1"
|
Loading…
Add table
Add a link
Reference in a new issue