FIX: twitter card meta tags use wrong urls on subfolder installs
This commit is contained in:
parent
c70f52c4dd
commit
f3eb58092d
|
@ -150,11 +150,15 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
# Use the correct scheme for open graph image
|
||||
if opts[:image].present? && opts[:image].start_with?("//")
|
||||
uri = URI(Discourse.base_url)
|
||||
opts[:image] = "#{uri.scheme}:#{opts[:image]}"
|
||||
elsif opts[:image].present? && opts[:image].start_with?("/uploads/")
|
||||
opts[:image] = "#{Discourse.base_url}#{opts[:image]}"
|
||||
if opts[:image].present?
|
||||
if opts[:image].start_with?("//")
|
||||
uri = URI(Discourse.base_url)
|
||||
opts[:image] = "#{uri.scheme}:#{opts[:image]}"
|
||||
elsif opts[:image].start_with?("/uploads/")
|
||||
opts[:image] = "#{Discourse.base_url}#{opts[:image]}"
|
||||
elsif GlobalSetting.relative_url_root && opts[:image].start_with?(GlobalSetting.relative_url_root)
|
||||
opts[:image] = "#{Discourse.base_url_no_prefix}#{opts[:image]}"
|
||||
end
|
||||
end
|
||||
|
||||
# Add opengraph & twitter tags
|
||||
|
|
Loading…
Reference in New Issue