nephila / django-meta

Pluggable app to allow Django developers to quickly add meta tags and OpenGraph, Twitter, and Google Plus properties to their HTML responses.
https://django-meta.readthedocs.io
Other
480 stars 68 forks source link

keyword is not rendering properly. #116

Closed saileshkush95 closed 4 years ago

saileshkush95 commented 4 years ago

I'm trying to use django-meta in my project but, keyword is not rendering properly. here is screnshot. Screenshot from 2020-07-20 20-03-56 and here is my setup


.................................
    image_credit = models.CharField(_("Image Credit"), max_length=50)
    content = models.TextField(_("Content"))
    keyword = models.TextField(_("Keyword"), editable=True)
..............................

    class Meta:
        ordering = ['-updated']
        verbose_name = _("Post")
        verbose_name_plural = _("Posts")

    def clean_content(self, *args, **kwargs):
        import re
        cleanr = re.compile('<.*?>')
        cleantext = re.sub(cleanr, '', self.content)
        return cleantext

    _metadata = {
        'title': 'title',
        'description': 'clean_content',
        'image': 'get_meta_image',
        'keywords': 'keyword',
    }

    def get_meta_image(self):
        if self.image:
            return self.image.url