Skip to content

Commit

Permalink
fix: change the description field for bluesky previews (#365)
Browse files Browse the repository at this point in the history
more nginx config
  • Loading branch information
Zir0h authored Dec 8, 2023
1 parent b4e8dc5 commit 9873116
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions docker/previews.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,16 @@ function _M.findTokenDetails(search)
end

function _M.injectOpenGraphTags(body, info)
local newBody = body;

-- cleanup old meta tags
body = ngx.re.gsub(body, '<meta.*?property="og.*?/>', '', 'm')
body = ngx.re.gsub(body, '<meta.*?name="twitter.*?/>', '', 'm')
body = ngx.re.gsub(body, '\n+', '', 'jom') -- I cannot be bothered to do multiline regex stuff
body = ngx.re.gsub(body, '<meta.*?property="og.*?/>', '', 'jo')
body = ngx.re.gsub(body, '<meta.*?name="twitter.*?/>', '', 'jo')
body = ngx.re.gsub(body, '<!-- OPEN GRAPH -->.*?/>', '', 'jo')

local url = ngx.var.scheme .. '://' .. ngx.var.host .. ngx.var.request_uri

local openGraphTags = '' ..
'<meta name="description" content="' .. info['description'] .. '" />' ..
'<meta property="og:type" content="website" />' ..
'<meta property="og:title" content="' .. info['name'] .. '" />' ..
'<meta property="og:description" content="' .. info['description'] .. '" />' ..
Expand Down

0 comments on commit 9873116

Please sign in to comment.