Move post meta definition to separate file

This commit is contained in:
redmt 2022-06-10 15:18:36 +02:00
parent 5ef61af67f
commit 932d7f07ee
2 changed files with 39 additions and 34 deletions

View File

@ -0,0 +1,38 @@
meta(property='og:title', content=cleanTitle(post.title) + ' : r/' + subreddit)
meta(property='og:description', content='' + post.selftext)
meta(property='og:author_name', content='u/' + post.author)
if !post.has_media
if post.gallery
meta(property='twitter:card', content='summary_large_image')
meta(property='og:type', content='image')
each item in post.gallery_items
meta(property='og:image', content='' + item.large)
if post.images
meta(property='twitter:card', content='summary_large_image')
meta(property='og:type', content='image')
meta(property='og:image', content='' + post.images.source)
meta(property='og:image:url', content='' + post.images.source)
else
if post.media
if post.media.not_hosted_in_reddit
if post.media.source === 'YouTube'
meta(property='twitter:card', content='player')
meta(property='og:type', content='video')
meta(property='og:video', content='' + post.media.embed_src)
else
if post.media.source === 'external'
if post.images
meta(name='twitter:card', content='summary_large_image')
meta(property='og:type', content='image')
meta(property='og:image', content='' + post.images.source)
meta(property='og:image:src', content='' + post.images.source)
else
meta(name='twitter:card', content='summary_large_image')
meta(property='og:type', content='image')
meta(property='og:image', content='' + post.media.source)
meta(property='og:image:url', content='' + post.media.source)
else
meta(property='twitter:card', content='player')
meta(property='og:type', content='video')
meta(property='og:video', content='' + post.media.source)
meta(property='og:video:type', content='video/mp4')

View File

@ -2,40 +2,7 @@ doctype html
html
head
title #{cleanTitle(post.title)} : #{subreddit}
meta(property='og:title', content=cleanTitle(post.title) + ' : r/' + subreddit)
meta(property='og:description', content='' + post.selftext)
meta(property='og:author_name', content='u/' + post.author)
if !post.has_media
if post.gallery
meta(property='twitter:card', content='summary_large_image')
each item in post.gallery_items
meta(property='og:image', content='' + item.large)
if post.images
meta(property='twitter:card', content='summary_large_image')
meta(property='og:image', content='' + post.images.source)
meta(property='og:image:url', content='' + post.images.source)
else
if post.media
if post.media.not_hosted_in_reddit
if post.media.source === 'YouTube'
meta(property='twitter:card', content='player')
meta(property='og:type', content='video')
meta(property='og:video', content='' + post.media.embed_src)
else
if post.media.source === 'external'
if post.images
meta(name='twitter:card', content='summary_large_image')
meta(property='og:image', content='' + post.images.source)
meta(property='og:image:src', content='' + post.images.source)
else
meta(name='twitter:card', content='summary_large_image')
meta(property='og:image', content='' + post.media.source)
meta(property='og:image:url', content='' + post.media.source)
else
meta(property='twitter:card', content='player')
meta(property='og:type', content='video')
meta(property='og:video', content='' + post.media.source)
meta(property='og:video:type', content='video/mp4')
include includes/meta_post.pug
include includes/head.pug
body(class=""+ (user_preferences.theme === 'auto' ? 'dark' : user_preferences.theme) + "")
include includes/topbar.pug