lib/tdiary/plugin/00default.rb in tdiary-5.0.4 vs lib/tdiary/plugin/00default.rb in tdiary-5.0.5
- old
+ new
@@ -208,11 +208,11 @@
<meta name="viewport" content="width=device-width,initial-scale=1">
#{author_name_tag}
#{author_mail_tag}
#{index_page_tag}
#{icon_tag}
- #{default_ogp}
+ #{ogp_tag}
#{description_tag}
#{css_tag.chomp}
#{jquery_tag.chomp}
#{script_tag.chomp}
#{title_tag.chomp}
@@ -320,41 +320,33 @@
else
''
end
end
-def default_ogp
- if @conf.options2['sp.selected'] && @conf.options2['sp.selected'].include?('ogp.rb')
- if defined?(@conf.banner)
- %Q[<meta content="#{base_url}images/ogimage.png" property="og:image">]
- 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|<meta property="#{k}" content="#{v}">|
- }.join("\n")
+ ogp['og:type'] = 'website'
+ ogp['og:description'] = @conf.description
+ ogp['og:url'] = uri
end
+
+ ogp.map { |k, v|
+ %Q|<meta property="#{k}" content="#{h(v)}">|
+ }.join("\n")
end
def description_tag
if @conf.description and not(@conf.description.empty?) then
%Q[<meta name="description" content="#{h @conf.description}">]
@@ -362,10 +354,10 @@
''
end
end
def jquery_tag
- %Q[<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>]
+ %Q[<script src="//ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js"></script>]
end
enable_js( '00default.js', async: false )
add_js_setting( '$tDiary.style', "'#{@conf.style.downcase.sub( /\Ablog/, '' )}'" )