print any meta tags in @meta_tags in layout, add twitter ones for story pages

This commit is contained in:
joshua stein 2015-12-31 09:13:34 -06:00
parent 5129733b04
commit 9e238647e0
2 changed files with 13 additions and 0 deletions

View file

@ -150,6 +150,14 @@ class StoriesController < ApplicationController
format.html {
@comment = @story.comments.build
@meta_tags = {
"twitter:card" => "summary",
"twitter:site" => "@lobsters",
"twitter:title" => @story.title,
"twitter:description" => "#{@story.comments_count} comment" <<
"#{@story.comments_count == 1 ? "" : "s"}",
}
load_user_votes
render :action => "show"

View file

@ -11,6 +11,11 @@
<meta name="robots" content="noarchive,noodp,noydir" />
<meta name="referrer" content="always" />
<meta name="theme-color" content="#AC130D" />
<% if @meta_tags %>
<% @meta_tags.each do |k,v| %>
<meta name="<%= k %>" content="<%= v %>" />
<% end %>
<% end %>
<link rel="shortcut icon" href="/favicon.ico" />
<% if @short_url %>
<link rev="canonical" rel="self alternate shorter shorturl shortlink"