diff --git a/lib/tdiary/plugin/00default.rb b/lib/tdiary/plugin/00default.rb
index b39c60eed..53674c2cb 100644
--- a/lib/tdiary/plugin/00default.rb
+++ b/lib/tdiary/plugin/00default.rb
@@ -210,7 +210,7 @@ def doctype
#{author_mail_tag}
#{index_page_tag}
#{icon_tag}
- #{default_ogp}
+ #{ogp_tag}
#{description_tag}
#{css_tag.chomp}
#{jquery_tag.chomp}
@@ -322,37 +322,29 @@ def icon_tag
end
end
-def default_ogp
- if @conf.options2['sp.selected'] && @conf.options2['sp.selected'].include?('ogp.rb')
- if defined?(@conf.banner)
- %Q[]
- end
+def ogp_tag
+ uri = @conf.index.dup
+ uri[0, 0] = base_url if %r|^https?://|i !~ @conf.index
+ uri.gsub!( %r|/\./|, '/' )
+ image = (@conf.banner.nil? || @conf.banner == '') ? File.join(uri, "#{theme_url}/ogimage.png") : @conf.banner
+ ogp = {
+ 'og:title' => title_tag.gsub(/<[^>]*>/, ""),
+ 'og:image' => image,
+ }
+ if @mode == 'day' then
+ ogp['og:type'] = 'article'
+ ogp['article:author'] = @conf.author_name
+ ogp['og:site_name'] = @conf.html_title
+ ogp['og:url'] = uri + anchor( @date.strftime( '%Y%m%d' ) )
else
- uri = @conf.index.dup
- uri[0, 0] = base_url if %r|^https?://|i !~ @conf.index
- uri.gsub!( %r|/\./|, '/' )
- image = @conf.banner.nil? ? File.join(uri, "#{theme_url}/ogimage.png") : @conf.banner
- ogp = {
- 'og:title' => title_tag.gsub(/<[^>]*>/, ""),
- 'og:image' => (h image),
- }
- ogp['fb:app_id'] = @conf['ogp.facebook.app_id']
- ogp['fb:admins'] = @conf['ogp.facebook.admins']
- if @mode == 'day' then
- ogp['og:type'] = 'article'
- ogp['article:author'] = @conf.author_name
- ogp['og:site_name'] = @conf.html_title
- ogp['og:url'] = h(uri + anchor( @date.strftime( '%Y%m%d' ) ))
- else
- ogp['og:type'] = 'website'
- ogp['og:description'] = h(@conf.description)
- ogp['og:url'] = h(uri)
- end
-
- ogp.map { |k, v|
- %Q||
- }.join("\n")
+ ogp['og:type'] = 'website'
+ ogp['og:description'] = @conf.description
+ ogp['og:url'] = uri
end
+
+ ogp.map { |k, v|
+ %Q||
+ }.join("\n")
end
def description_tag