mirror of
https://github.com/meineerde/holgerjust.de.git
synced 2025-10-17 17:01:01 +00:00
Add meta tags for twitter and facebook
This commit is contained in:
parent
b44b4d9595
commit
f181e40568
@ -117,4 +117,24 @@ module MiddlemanCasperHelpers
|
||||
def author_path
|
||||
"#{blog.options.prefix.to_s}/author/#{blog_author.name.parameterize}/"
|
||||
end
|
||||
|
||||
def og_type
|
||||
if is_blog_article?
|
||||
'article'
|
||||
else
|
||||
'website'
|
||||
end
|
||||
end
|
||||
|
||||
def og_title
|
||||
if current_page.data.title
|
||||
current_page.data.title
|
||||
elsif is_tag_page?
|
||||
current_resource.metadata[:locals]['tagname']
|
||||
elsif is_blog_article?
|
||||
current_article.title
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -7,6 +7,28 @@
|
||||
%meta{name: :viewport, content: 'width=device-width, initial-scale=1.0'}
|
||||
%meta{'http-equiv' => 'X-UA-Compatible', content: 'IE=edge'}
|
||||
%meta{name: 'HandheldFriendly', content: 'True'}
|
||||
|
||||
%meta{property: "og:site_name", content: blog_settings.name}
|
||||
%meta{property: "og:type", content: og_type}
|
||||
- if !og_title.nil?
|
||||
%meta{property: "og:title", content: og_title}
|
||||
%meta{property: "og:description", content: page_description}
|
||||
%meta{property: "og:url", content: URI.join(blog_settings.url, current_page.url)}
|
||||
- if cover?
|
||||
%meta{property: "og:image", content: URI.join(blog_settings.url, image_path(current_page.data.cover))}
|
||||
- if is_blog_article?
|
||||
%meta{property: "article:published_time", content: current_article.date.strftime('%Y-%m-%d')}
|
||||
|
||||
%meta{name: "twitter:card", content: "summary"}
|
||||
- if blog_author.twitter
|
||||
%meta{name: "twitter:site", content: "@#{blog_author.twitter}"}
|
||||
- if og_title
|
||||
%meta{name: "twitter:title", content: og_title}
|
||||
%meta{name: "twitter:description", content: page_description}
|
||||
%meta{name: "twitter:url", content: URI.join(blog_settings.url, current_page.url)}
|
||||
- if cover?
|
||||
%meta{name: "twitter:image:src", content: URI.join(blog_settings.url, image_path(current_page.data.cover))}
|
||||
|
||||
= feed_tag :atom, "#{blog.options.prefix.to_s}/feed.xml", title: "Atom Feed"
|
||||
= favicon_tag 'images/favicon.ico'
|
||||
= stylesheet_link_tag :application
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user