forked from diaspora/diaspora
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added some basic open graph tags to the posts#show page.
- Loading branch information
Showing
4 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,38 @@ | |||
module OpenGraphHelper | |||
def og_title(post) | |||
meta_tag_with_property('og:title', post_page_title(post)) | |||
end | |||
|
|||
def og_type(post) | |||
meta_tag_with_property('og:type', 'article') | |||
end | |||
|
|||
def og_url(post) | |||
meta_tag_with_property('og:url', post_url(post)) | |||
end | |||
|
|||
def og_image(post) | |||
if post.photos.present? | |||
img_url = post.photos.first.url(:thumb_medium) | |||
meta_tag_with_property('og:image', img_url) | |||
end | |||
end | |||
|
|||
def og_site_name | |||
meta_tag_with_property('og:site_name', 'Diaspora*') | |||
end | |||
|
|||
def og_description(post) | |||
meta_tag_with_property('og:description', post_page_title(post)) | |||
end | |||
|
|||
def og_page_specific_tags(post) | |||
[og_title(post), og_type(post), | |||
og_url(post), og_image(post), | |||
og_description(post)].join(' ').html_safe | |||
end | |||
|
|||
def meta_tag_with_property(name, content) | |||
content_tag(:meta, '', :property => name, :content => content) | |||
end | |||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters