This commit is contained in:
BoHung Chiu 2022-01-03 22:09:11 +08:00
parent 7f4db2cb7d
commit c9c6ccde73
1 changed files with 2 additions and 1 deletions

View File

@ -46,6 +46,7 @@ class SiteFeedAnnc
end
end
cache_data = {}
site_root_url = Site.first.root_url rescue ""
locales.each do |locale|
locale = locale.to_s
data_for_locale = anns.collect do |a|
@ -94,7 +95,7 @@ class SiteFeedAnnc
tmp["source-site-link"] = tmp["source-site"]
tmp["source-site"] = "<a href='#{tmp["source-site"]}' target='_blank' class='feed-source'>#{tmp["source-site-title"]}</a>"
tmp["link_to_show"] = !tmp["external_link"].blank? ? tmp["external_link"] : nil
tmp["target"] = "_self"
tmp["target"] = (site_root_url.blank? || tmp["link_to_show"].blank?) ? '_blank' : (tmp["link_to_show"].include?(site_root_url) ? '_self' : '_blank')
tmp["img_src"] = tmp["image"]["thumb"] || "/assets/announcement-default.jpg"
tmp["img_description"] = tmp["image_description_translations"][locale]
tmp["more"] = trans[locale]['more_plus']