client: og-tags fix for restricted posts
This commit is contained in:
parent
7d90a73b11
commit
38080611d5
1 changed files with 7 additions and 2 deletions
|
@ -26,8 +26,13 @@ add_meta_tag("og:url", ngx.var.external_host_url .. ngx.var.request_uri)
|
|||
|
||||
if ngx.var.request_uri_path:match('^/post') then
|
||||
local post_info = cjson.decode((ngx.location.capture("/_internal_api"..ngx.var.request_uri_path)).body)
|
||||
add_meta_tag("og:image", ngx.var.external_host_url .. '/' .. post_info.contentUrl)
|
||||
add_meta_tag("og:title", server_info.config.name .. " - Post " .. post_info.id)
|
||||
-- If no permission to access, fields will be nil, thus cannot be concat'd
|
||||
if post_info.contentUrl then
|
||||
add_meta_tag("og:image", ngx.var.external_host_url .. '/' .. post_info.contentUrl)
|
||||
end
|
||||
if post_info.id then
|
||||
add_meta_tag("og:title", server_info.config.name .. " - Post " .. post_info.id)
|
||||
end
|
||||
end
|
||||
|
||||
local final_response = page_html.body:gsub("{{ generated_head_tags }}", additional_tags)
|
||||
|
|
Loading…
Reference in a new issue