Only use entry.excerpt as a description if it wasn't already used as a title
This commit is contained in:
parent
d8a6dbf2bf
commit
8853e42508
1 changed files with 6 additions and 1 deletions
|
@ -40,7 +40,7 @@ class Entry(ModelMeta, models.Model):
|
||||||
updated = models.DateTimeField()
|
updated = models.DateTimeField()
|
||||||
|
|
||||||
_metadata = {
|
_metadata = {
|
||||||
'description': 'excerpt',
|
'description': 'excerpt_if_unused',
|
||||||
'image': 'image_url',
|
'image': 'image_url',
|
||||||
'twitter_creator': 'twitter_creator',
|
'twitter_creator': 'twitter_creator',
|
||||||
'og_profile_id': 'og_profile_id',
|
'og_profile_id': 'og_profile_id',
|
||||||
|
@ -55,6 +55,11 @@ class Entry(ModelMeta, models.Model):
|
||||||
first_line = self.content.split('\n')[0]
|
first_line = self.content.split('\n')[0]
|
||||||
return shorten(first_line, width=100, placeholder='…')
|
return shorten(first_line, width=100, placeholder='…')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def excerpt_if_unused(self):
|
||||||
|
if self.name:
|
||||||
|
return self.excerpt
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def twitter_creator(self):
|
def twitter_creator(self):
|
||||||
return self.author.twitter_username
|
return self.author.twitter_username
|
||||||
|
|
Loading…
Reference in a new issue