ember-cli-document-title icon indicating copy to clipboard operation
ember-cli-document-title copied to clipboard

Support for other meta tags

Open t4t5 opened this issue 10 years ago • 16 comments

This is a great little nifty library! I'm currently using it on https://www.ludu.co together with Prerender.io in order not to screw up SEO with Ember. :) Do you have any plans on extending it to support for example description tags or Facebook's open graph tags? In my case, I would love to be able to set the og:image based on the model's image for example.

t4t5 avatar Mar 02 '15 16:03 t4t5

I don't have any specific plans to do this, but I can see the value and really like the idea! Seems doable, although maybe a little brittle (the way it works at the moment is slightly brittle as well, especially considering the changes coming up in Ember, with Fastboot and everything).

How would you like it to work in your app, API wise? What kind of hooks do you envision needing?

kimroen avatar Mar 03 '15 14:03 kimroen

I haven't actually looked at your code to be honest, but it seems to work fine right now and it just makes a lot of sense to put that stuff as values on the route-level as you have done. What I see as mandatory for every page is a title, description and image. It would be nice to be able to just set these three simple values and let the addon automatically set the necessary meta tags, OpenGraph tags, Twitter card tags... etc. Fits well with the ember philosophy of reducing boiler-plate code too!

t4t5 avatar Mar 04 '15 10:03 t4t5

Oh, I get what you're saying, I was just wondering how you would like it to work when you use it in your app!

Right now we have the two hooks, titleToken and title that are available on all routes. These would need to be more generic. Given that you can define any number of tags you want, probably with different kinds of needs, we'll nee to rework how things work.

For instance, descriptions probably don't need the bubbling behavior, it should just use the description defined in the leafmost route, and the same thing probably goes for things like images.

Should you define those three things (title, description and image), and then specify which meta tags you want, or should you specify all of them independently? How can we make that clear? What about more obscure tags, like the tags google analytics wants for ecommerce-sites, for instance?

At first glance, it seems that a lot of thought will be required to come up with something that is flexible enough to handle these things.

I'm not concerned about the implementation - defining the hooks is the hard part here.

I'll give it a think, but let me know if you have some insights or ideas :)

kimroen avatar Mar 08 '15 19:03 kimroen

Hi @kimroen, thanks for making this! It's the best thing I could find so far when it comes to doing SEO. From the sounds of things, you seem interested in improving/expanding this Addon as good as can be and I know enough about ember & have digital MKTG experience to provide some suggestions. If this was of interest, let me know! I'm available to chat via email/skype/screenhero the next few days.

e-karma avatar Mar 17 '15 17:03 e-karma

+1 for more tags options! Description, especially.

edborden avatar Mar 23 '15 22:03 edborden

Again, ideas for how you would want this to look during use would be really helpful!

I have some thoughts, but would love some more perspective.

kimroen avatar Mar 24 '15 11:03 kimroen

Following the model that liquid-fire has setup would be ideal from my perspective.

By that I mean having minimally all Meta/Title inputs for the entire app on one page that could be appended invisibly(addon style) to the router.js file structured in JSON-API format? { route1: { title: meta-description: }, route2: { title: ....etc etc. } }

e-karma avatar Mar 24 '15 11:03 e-karma

I like the idea, but I think it's another add-on, not this library. We have a RouteMetaMixin that is used for exactly this purpose. Here's the source if you'd like to check it out. Yeah, yeah it's CoffeeScript - we're migrating to ES2015 over time.

This add-on is nice and simple just for handling the page title. Perhaps a good starting place would be forking this library and changing the name if that's the kind of functionality you're wanting.

blimmer avatar Mar 26 '15 20:03 blimmer

@blimmer I agree that it would probably be a separate library. Thanks for sharing!

Oh, and I don't mind CoffeeScript ;) (kimroen/ember-cli-coffeescript)

kimroen avatar Mar 26 '15 20:03 kimroen

We're using it! Thanks for maintaining that library, it's been totally invaluable as we migrate our global app to CoffeeScript.

blimmer avatar Mar 26 '15 20:03 blimmer

ember-cli-document-title + RouteMetaMixin looks like a great combo. You should release RouteMetaMixin as it's own add-on!

edborden avatar Apr 10 '15 14:04 edborden

Hi, I just made an add-on working with any other meta (& title) for my own use :

https://github.com/didacte/ember-meta-meta

I do not deal with nesting tokens, you could deal with it in your app or make a pull request to add this feature.

j15e avatar Apr 21 '15 17:04 j15e

Fantastic addition! Thanks for sharing. I just installed and it works exactly as advertised.

On Tue, Apr 21, 2015 at 10:29 AM, Jean-Philippe Doyle < [email protected]> wrote:

Hi, I just made an add-on working with any other meta (& title) for my own use :

https://github.com/didacte/ember-meta-meta

I do not deal with nesting tokens, you could deal with it in your app or make a pull request to add this feature.

— Reply to this email directly or view it on GitHub https://github.com/kimroen/ember-cli-document-title/issues/4#issuecomment-94880217 .

e-karma avatar Apr 21 '15 22:04 e-karma

@j15e That's very cool - thanks for sharing!

kimroen avatar Apr 22 '15 16:04 kimroen

@blimmer told me about the interest in my RouteMetaMixin.

I've finally addon'd it as ember-cli-meta-tags converting it to javascript in the process. I also eliminated the lodash dependency we had when we were using it internally and added several tests.

I see @j15e has developed an alternate one-stop solution which looks great too.

ronco avatar Apr 23 '15 04:04 ronco

@blimmer Yeah, yeah it's CoffeeScript - we're migrating to ES2015 over time. Why are you apologizing for using coffeescript? I find the argument that it is now antiquated due to es6/babel/etc to be misleading and highly subjective. Coffeescript has been and remains a powerful tool if you know how to use it AND you are productive with it (I know many that are). You should never use a language/framework/tool/etc strictly because "everyone else is"... /endrant

erichaus avatar Oct 23 '15 04:10 erichaus