Archived
1
0

add brief text to opengraph description

This commit is contained in:
Jeff 2018-08-25 15:44:37 -04:00
parent 92b2550865
commit df450e31ca
3 changed files with 9 additions and 1 deletions

View File

@ -47,6 +47,7 @@ type AttachmentModel interface {
type PostModel interface { type PostModel interface {
BaseModel BaseModel
Brief() string
CSSClass() string CSSClass() string
FrontendPubkey() string FrontendPubkey() string
MessageID() string MessageID() string

View File

@ -305,6 +305,13 @@ func (self *post) Index() int {
return self.index + 1 return self.index + 1
} }
func (self *post) Brief() string {
if len(self.PostMessage) > 140 {
return self.PostMessage[:140]
}
return self.PostMessage
}
func (self *post) NumImages() int { func (self *post) NumImages() int {
return len(self.Files) return len(self.Files)
} }

View File

@ -24,7 +24,7 @@
<meta property="og:site_name" content="changolia" /> <meta property="og:site_name" content="changolia" />
<meta property="og:type" content="website"/> <meta property="og:type" content="website"/>
<meta property="og:title" content="{{board.Board}}"/> <meta property="og:title" content="{{board.Board}}"/>
<meta property="og:description" content="thread no. {{thread.OP.PostHash}} on changolia"/> <meta property="og:description" content="{{thread.OP.Brief}}"/>
{{#sfw}} {{#sfw}}
<meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/?lang={{i18n.Name}}&sfw=1"/> <meta property="og:url" content="{{prefix}}t/{{thread.OP.PostHash}}/?lang={{i18n.Name}}&sfw=1"/>
{{/sfw}} {{/sfw}}