large previews for some sites

unless they need oembed (glares at mastodon), which requires
the ability to resize images on the fly. lol. lmao
This commit is contained in:
rhiannon morris 2022-12-26 20:07:38 +01:00
parent 47ba520e7e
commit 3c04976d1a

View file

@ -9,7 +9,7 @@ import qualified NsfwWarning
import Control.Exception import Control.Exception
import Control.Monad import Control.Monad
import Data.List (sort, intersperse) import Data.List (sort, intersperse)
import Data.Maybe (fromMaybe) import Data.Maybe (fromMaybe, isNothing)
import qualified Data.Text as Strict import qualified Data.Text as Strict
import qualified Data.Text.Lazy as Lazy import qualified Data.Text.Lazy as Lazy
import System.FilePath (joinPath, splitPath) import System.FilePath (joinPath, splitPath)
@ -97,6 +97,16 @@ make' root siteName prefix nsfw _dataDir dir
let nsfwScript = NsfwWarning.script nsfw' let nsfwScript = NsfwWarning.script nsfw'
let nsfwDialog = NsfwWarning.dialog nsfw' let nsfwDialog = NsfwWarning.dialog nsfw'
let imageMeta =
if #sfw image0 && isNothing (#warning image0) then [b|@0
<meta property=og:image content="$url/$path0'">
<meta name=twitter:card content=summary_large_image>
<meta name=twitter:image content="$url/$path0'">
|] else [b|@0
<meta property=og:image content="$url/$thumb">
<meta name=twitter:card content=summary>
|]
pure [b|@0 pure [b|@0
<!DOCTYPE html> <!DOCTYPE html>
<html lang=en> <html lang=en>
@ -105,14 +115,13 @@ make' root siteName prefix nsfw _dataDir dir
<link rel=stylesheet href=/style/shiny/single.css> <link rel=stylesheet href=/style/shiny/single.css>
<link rel=icon href=/style/niss.svg> <link rel=icon href=/style/niss.svg>
<meta property=og:type content=og:website> <meta property=og:type content=article>
<meta property=og:title content="$title"> <meta property=og:title content="$title">
<meta property=og:site_name content="$siteName"> <meta property=og:site_name content="$siteName">
<meta property=og:description content="$desc"> <meta property=og:description content="$desc">
<meta property=og:image content="$url/$thumb">
<meta property=og:url content="$url"> <meta property=og:url content="$url">
<meta name=twitter:site content=@2_gecs> <meta name=twitter:site content=@2_gecs>
<meta name=twitter:card content=summary> $imageMeta
<meta name=robots content='noai,noimageai'> <meta name=robots content='noai,noimageai'>