kpumuk / meta-tags Goto Github PK
View Code? Open in Web Editor NEWSearch Engine Optimization (SEO) for Ruby on Rails applications.
License: MIT License
Search Engine Optimization (SEO) for Ruby on Rails applications.
License: MIT License
I have a description e.g.
<% set_meta_tags description: "This is a description" %>
I'd like to append a page number when the user advances beyond page 1. However unlike content_for
, setting with set_meta_tags
replaces this value rather than appending.
Is there a solution in this gem for this, or would that be a new feature?
I need to add tags like:
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.example.net/feed.rss" />
to a blog index page. Unfortunately, this GEM isn't able to do that as far as i can see.
What about add support for the Dublin Core meta tags?
I would suggest to add official support from "meta-tags" gem, but I also would suggest that someone update the README.MD talking about DC and how to implement Dublin Core meta tags on a given website (like the mini-tutorial for OG tags and Twitter Cards).
What do you think about that?
Hi there,
I β€οΈ your gem!
I'm running into trouble trying to specify and image source and the additional (albeit optional) width
, height
and type
properties e.g. from Facebook's Example:
I'm trying to recreate this:
<meta property="og:image" content="http://example.com/lamb-full.jpg">
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="3523">
<meta property="og:image:height" content="2372">
Following your spec, I create this (you can see where it will fail):
set_meta_tags :og => {
:image => "http://example.com/lamb-full.jpg",
:image => {
:type => "'image/jpeg"
:width => "3523",
:height => "2372"
}
}
... and I get this when I call display_meta_tags
(the URL is missing)
<meta property="og:image:type" content="image/jpeg">
<meta property="og:image:width" content="3523">
<meta property="og:image:height" content="2372">
The reason why is obvious. Just wondering if you had any workarounds?
Cheers,
Lee π»
Is there an option to not show the default site title in the title tag ? (in order to only show the value passed to set_meta_tags :title
)
I know it's possible to reverse it with :reverse => true
, but I didn't find any option to completely remove it.
I want certain pages to only show their title and not the site name.
Thanks !
In README file, you could state that the gem may be installed in the Rails 3 Gemfile (with bundler) with the line:
gem 'meta-tags', :require => 'meta_tags'
and then:
bundle install
Thanks!
./stefan
Hi, thank you for this gem. I want to know if is possible, how can I add the meta fb:app_id or fb:admins
Thank you very much!
How can I add meta title?
I can see the title
<title> My Site | Title </title>
but I can not see in my head:
<meta content=" Title " name="title">
Thank you very much!
I get the above undefined method error when trying to configure via an initializer on Rails 4.1.13. Using meta-tags version 2.0.0. Also crops up when manually calling MetaTags.configure
in the console, and configure
doesn't show up in the list when running MetaTags.methods
via pry.
All examples on schema.org includes implementation using json-ld.
e.g., http://schema.org/Article
please add support for adding schema.org based structured metadata using json-ld.
If you do that then this gem will become a complete metadata solution.
Thanks!
You can't set any refresh meta tags eg:
<meta http-equiv="refresh" content="0;URL='http://example.com/'">
Open graph supports "structured properties" for images, videos, audio, etc.
Currently, this gem allows us to set them for a video through the [:og][:video]
hash. But [:og][:image]
takes a string or an array for the image urls, from which we get one or several og:image
tags.
It would be great to have an option [:og][:images]
that takes an array of hashes, where each hash can specify the :url
, :width
, :height
, :type
, and :secure_url
for the image. (Note the <meta name="og:image:url" ...>
tag is equivalent to og:image
.)
Specifying the width, height, and type is a convenience for people who are having trouble getting FB/Linkedin/etc to properly analyze their image. But being able to pass the secure_url is essential for sites whose image canonical protocol is https. And as we've seen just this month, Google is giving you points for moving towards the future of the web by using HTTPS.
While working on this, it would probably be good to look towards similar options for other Open Graph objects that can be listed multiple times and have individual properties.
Its really nice abilyti to create this tag:
with 2 attributes noindex and follow, this tell to the bot to no index the page, but follow the links present, its common use in the pages with pagination.
This would be a cool new additional feature. Add Facebook Open Graph met tags converting a web page into on open graph object.
Thanks for consideration,
Steve
Would an :icon
option be of value to this gem? If so, I'm willing to submit a pull-request for it.
Defaults to "image/x-icon":
set_meta_tags icon: "/favicon.ico"
<link href="/favicon.ico" rel="icon" type="image/x-icon">
Supporting different mime types:
set_meta_tags icon: { "image/png" => "/images/icon.png" }
<link href="/images/icon.png" rel="icon" type="image/png">
For visual checks of the generated HTML code it would be nice to have the output properties in the order name/property
and then content
.
Like this:
<meta name="author" content="..."/>
instead of the current output:
<meta content="..." name="author"/>
Is there a way to change title from
SITE_NAME | PAGE_NAME
To:
PAGE_NAME. SITE_NAME
A lot of the specs rely on matching tag strings, eg <meta content="this is a test" name="testing" />
This is rendered using ActionView::Base#tag
. In 4.2 the attribute order switches so the following does not match:
<meta content="this is a test" name="testing" />
<meta name="testing" content="this is a test" />
49 spec failures with latest Rails :-(
To reproduce:
Do fresh clone and bundle install or on existing bundle update actionpack
then
bundle exec rspec spec
I trying to figure out, but seems that is impossible to have a
(single space) as title separator. Like:
Site name Title name
If you use :separator => false
, you got joint words:
Site nameTitle name
If you use :separator => ''
, you got double spaces:
Site name Title name
if you use :separator => ' '
, you got triple spaces:
Site name Title name
If you don't use :separator
at all, you got a pipe:
Site name | Title name
So I presume there's no way to use _single space_, or am I missing something?
Love this gem, but it would be great if it could also support "user-defined" meta tags.
Would love to have the charset meta tag defined with it:
meta charset="utf-8"
Dunno if this is already possible?
Below is my trace:
β web git:(master) β rails s
/Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_view/helpers/asset_tag_helpers/asset_paths.rb:66: uninitialized constant ActionView::Helpers::AssetTagHelper::AssetPaths::Mutex (NameError)
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_view/helpers/asset_tag_helper.rb:3:in `require'
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_view/helpers/asset_tag_helper.rb:3
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_view/helpers.rb:38
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/actionpack-3.1.0.rc4/lib/action_view/base.rb:134
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/meta-tags-1.2.4/lib/meta_tags.rb:11
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:68:in `require'
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `each'
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:66:in `require'
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `each'
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler/runtime.rb:55:in `require'
from /Users/marshluca/.rvm/rubies/ree-1.8.7-2011.03/lib/ruby/gems/1.8/gems/bundler-1.0.10/lib/bundler.rb:120:in `require'
from /Users/marshluca/Code/Work/web/config/application.rb:7
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52:in `require'
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap'
from /Users/marshluca/Code/Work/web/vendor/bundle/ruby/1.8/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49
from script/rails:6:in `require'
from script/rails:6
It's possible to use this gem with turbolinks?
Google no longer supports Google+ Authors, so you can remove the code and demo for it.
Now we can't generate meta tag
<meta itemprop="description" content="description content" />
Will be this gem updated in the future?
Hi, I see meta-tags uses tag.rb filename which is in use by my tagging modell already. What can be done?
I have used below code in gem file:
gem 'meta-tags', :require => 'meta_tags'
and in layout
<%= set_meta_tags :site => 'Site Title', :title => 'Member Login' %>
I received the below output
{"site"=>"Site Title", "title"=>"Member Login"}
in wrong format unable to type here: html encode format is displayed there
I need <title>Hello </title> unable to type correct bracket here
I am getting this error in the production environment, but this is working perfectly fine in development.
ActionView::Template::Error (undefined method `display_meta_tags' for #<#<Class:0x0000000219c470>:0x00000002037eb8>):
14: %meta{:content => "yes", :name => "apple-touch-fullscreen"}
15: %meta{:content => "default", :name => "apple-mobile-web-app-status-bar-style"}
16:
17: = display_meta_tags @meta
18:
19: / BEGIN Vendor CSS
20: = stylesheet_link_tag 'dashboard/application', media: 'all', 'data-turbolinks-track' => true
app/views/layouts/dashboard.html.haml:17:in `_app_views_layouts_dashboard_html_haml__3819368442363062716_16686580'
It would be nice to accept any possible meta tag. For example, I need an author tag -- instead of adding support for just the author tag, why not add support to accept any meta tag?
pedrofs has an implementation of this: pedrofs@2f411bf
Here is my code that i put in my layout
<% set_meta_tags {"title"=>"The Hotel -:- Hometel Chandigarh", "og"=>{"description"=>"we are quick", "keywords"=>"localhost, sarovar chandigarh", "title"=>"Local Site", "type"=>"hotel", "url"=>"http://www.heeel.com:3000/", "image"=>"http://www.heeel.com:3000/"}} %>
but i cannot see any metatag in my page source.
I am trying to set the canonical URL in the view of a project and it always comes back undefined. I can successfully set it in the controller, but I want to be able to override it in the view occasionally.
This is what I am putting in the view..
<% canonical "http://google.com" %>
And I get this error..
undefined method `canonical' for #<#Class:0x007ff6b7b2b550:0x007ff6b52716f0>
I'm using..
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
Rails 4.2.3
Mac OS X 10.10.4
I am able to set the other tags in the view.
Any advice?
set_meta_tags = title: "&"
outputs <title>&&</title>
Should output <title>&</title>
I tried using the alternate links syntax specified in the second example (referenced below) but the output is empty.
set_meta_tags alternate: [
{ href: 'http://example.fr/base/url', hreflang: 'fr' },
{ href: 'http://example.com/feed.rss', type: 'application/rss+xml', title: 'RSS' },
{ href: 'http://m.example.com/page-1', media: 'only screen and (max-width: 640px)'},
]
It would be really nice if this gem produced the meta output with the name/property first and then the content. It does the job but the code is really hard to read in source.
Facebook open graphs are not recognized for if given in property like
<< meta property="og:type" content="website" >>
But it does recognizes
<< meta name="og:type" content="website" >>
see
http://stackoverflow.com/questions/6501189/opengraph-validation-for-html5
So can we have an option to change property key to name key
<< meta property='xx' >>
to
<< meta name='xx' >>
The meta attribute for Twitter Cards is name
, not property
<meta name="twitter:card" content="summary">
is it possible to add this tag for multilanguage websites?
<link rel="alternate" hreflang="de" href="http://example.com/de/" />
Thank you!
Hi!
Can I disable site name?
So I have:
on layout:
<%= display_meta_tags %>
on my page:
<% set_meta_tags(:title => @category.meta_title,
:keywords => @category.meta_keywords,
:description => @category.meta_description) %>
What in result:
<title> | sometitle</title>What I need:
<title>sometitle</title>How can I make that?
I get this strange error when running autotest:
ActionView::Template::Error:
cannot load such file -- html/sanitizer
When I go to the line its:
<%= display_meta_tags blah %>
Anyone know how to fix this?
The reason that you have to explicitly state require 'meta_tags'
is because the naming on this gem is not following the convention that Rubygems and Bundler do.
Rubygems βName Your Gem Guideβ
There is currently not a gem registered under meta_tags
in Rubygems, so it should be trivial to do a rename and release under the new heading without disrupting any existing installs. This would then allow people to simply enter gem 'meta_tags'
in their gemfile and it would be loaded automatically.
So you got in your layout:
<%= display_meta_tags :site => 'Site Name',
:open_graph => { :site_name => 'Site Name' } %>
And in some action:
<%- set_meta_tags :title => 'Page Title',
:open_graph => { :title => 'Page Title' } %>
This results in:
<title>Site Name | Page Title</title>
<meta content="Page Title" property="og:title" />
That is we lost this one:
<meta content="Site Name" property="og:site_name" />
got this error in normalize_title(title) line 211 and following in view_helper.rb.
to fix it, add
title = title.dup if title.frozen?
as first line in the function.
Hi
The twitter card example in document shows the output:
<meta property="twitter:card" content="summary"/>
<meta property="twitter:site" content="@username"/>
Which is incorrect. The document in twitter say it uses name, not property.
The following code:
set_meta_tags og: {description: 'Testing "double quotes".'}
Will output HTML below:
<meta content="Testing "double quotes"." property="og:description" />
Double quotes are not escaped, breaking the HTML markup.
The following code:
set_meta_tags :title => venue.name, :og => {
url: request.fullpath,
type: venue.type.name,
title: venue.name,
place: {
location: {
latitude: venue.latitude.to_i,
longitude: venue.longitude.to_i
}
}
}
Generates:
<meta content="/venues/19-sunt-eos" property="og:url" />
<meta content="Convention Center" property="og:type" />
<meta content="Sunt Eos" property="og:title" />
<meta content="{:location=>{:latitude=>49, :longitude=>-122}}" property="og:place" />
I will try to rollback to previous versions and see if the problem still exists. Current version: 1.2.6
Has it been considered to add ability to add meta tags using i18n locale files?
E.g. in a namespace like:
en:
meta_tags:
[controller]:
[action]:
title: My locale title
description: Foo baa
etc. ?
I am perhaps missing something, but I can't seem to get the proper output using this plugin with rails 3. I'm including the gem using the Bundler gemfile, and the gem is properly installed after running bundle install. I also get a "true" when running require 'meta_tags' from irb.
It seems though that something is missing because the set_meta_tags method throws an error whenever I attempt to use it, and the the <% title 'Document Title' %> tag in the erb file doesn't throw an error, but doesn't output anything.
Seems like I'm missing something. Is my using bundler to manage this plugin incorrect? It seems to me that the installation instructions on the readme apply only to rails 2.
Thanks in advance
https://developers.facebook.com/docs/opengraph/howtos/maximizing-distribution-media-content/
meta property="fb:app_id" content="[FB_APP_ID]"
Is this implementable in your gem's current state?
Is it fully Compatible with Rails 4 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.