forked from 00dani/lemoncurry
Smarter generation of OGP/Schema.org/etc. metadata, with HTML tags stripped out so the result looks nice and clean
This commit is contained in:
parent
b8a74443c9
commit
ea241577f1
3 changed files with 17 additions and 4 deletions
|
@ -4,6 +4,7 @@ from django.contrib.sites.models import Site as DjangoSite
|
|||
from django.utils.functional import cached_property
|
||||
from meta.models import ModelMeta
|
||||
from urllib.parse import urljoin
|
||||
from lemoncurry import utils
|
||||
|
||||
|
||||
def avatar_path(instance, name):
|
||||
|
@ -45,6 +46,10 @@ class User(ModelMeta, AbstractUser):
|
|||
def get_absolute_url(self):
|
||||
return self.url
|
||||
|
||||
@property
|
||||
def description(self):
|
||||
return utils.to_plain(self.note)
|
||||
|
||||
@property
|
||||
def avatar_url(self):
|
||||
return self.avatar.url
|
||||
|
@ -81,7 +86,7 @@ class User(ModelMeta, AbstractUser):
|
|||
|
||||
_metadata = {
|
||||
'image': 'avatar_url',
|
||||
'description': 'note',
|
||||
'description': 'description',
|
||||
'og_type': 'profile',
|
||||
'og_profile_id': 'facebook_id',
|
||||
'twitter_creator': 'twitter_username',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue