Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
django-kp-html-meta
Readme
kp_html_meta is a Django app to generate html meta tags for improve SEO.
Install django-kp-html-meta::
pip install django-kp-html-meta
Add "kp_static_version" to your INSTALLED_APPS setting like this::
INSTALLED_APPS = [ ... 'kp_html_meta', ]
Define default values in you settings.py (optional)::
KP_META = { 'kp_meta_title': "Test title", # ex: Test title 'kp_meta_description': "Test description", # ex: 'kp_meta_keywords': "Test keyword", 'kp_meta_graph_type': "article ", 'kp_meta_graph_image': "https://mywebsite.com/logo.jpg", 'kp_meta_graph_url': "https://mywebsite.com", 'kp_meta_graph_locale': "en", 'kp_get_base_url': "https://mywebsite.com", 'kp_meta_graph_site_name': "mywebsite", }
Load templatetags into your template::
{% load kp_meta %}
{% kp_meta %}Result::
Test titleThe values defined in the settings.py file are default values. They are used if no other values exist. You can customize the content of the HTML tags according to your templates. Example::
from django.db import models
from kp_html_meta.models import KPMetaHelper
class DummyModel(models.Model, KPMetaHelper):
# ... some fields
def get_kp_meta_title(self):
# kp_meta_title in settings.py
return self.title
def get_kp_meta_description(self):
# kp_meta_description in settings.py
return self.text_of_my_article[:200]
def get_kp_meta_keywords(self):
# If None then the value defined in settings.py will be used.
# kp_meta_keywords in settings.py
return None
def get_kp_meta_graph_type(self):
return None
def get_kp_meta_graph_image(self):
return None
def get_kp_meta_graph_url(self):
return None
def get_kp_meta_graph_locale(self):
return None
def get_kp_meta_graph_site_name(self):
"""
Return site name
for example:
return "mywebsite.tld"
or
from django.conf import settings
kp_settings = getattr(settings, 'KP_META')
:return kp_settings['kp_meta_graph_site_name']
or
from django.contrib.sites.models import Site
current_site = Site.objects.get_current()
return current_site.domain
"""
return None
def get_kp_get_base_url(self):
"""
Return base url
for example:
return "https://mywebsite.tld"
or
from django.conf import settings
kp_settings = getattr(settings, 'KP_META')
:return kp_settings['kp_get_base_url']
or
from django.contrib.sites.models import Site
current_site = Site.objects.get_current()
return "https://%s" % current_site.domain
"""
return None
You can extend your templates with predefined fields::
from kp_html_meta.models import KPMetaGraphFiler
# if you use django-filer
class DummyModel(KPMetaGraphFiler):
from kp_html_meta.models import KPMetaGraphFileBrowser
# if you use django-filebrowser
class DummyModel(KPMetaGraphFileBrowser):
If you customize your models, use the templatetags like this::
{% load kp_meta %}
<head>
<meta charset="UTF-8">
{% kp_meta myobj %}
</head>
FAQs
kp_html_meta is a Django app to generate html meta tags for improve SEO.
We found that django-kp-html-meta demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.