Git Product home page Git Product logo

headly's Introduction

headly

meteor package to handle external service requests to generate metatag responses (for og:metatags use)

Install

Use meteorite

Then add headly to your meteor app using:

mrt add headly

... or ... you can clone the code to your meteor/packages directory manually

config headly

In your server code use something like:

Meteor.headly.config({
    data: function(req){
      //do something dynamic here, i.e get title from db based on url param
      return {title: dynamic.title};
    },
    facebook: function(data) {
      return '<meta property="og:title" content="'+data.title+'" />';
    },
    twitter: function(data) {
      return '<meta name="twitter:card" content="summary"> ';
}});

.. or try the example first to get the hang of it:

  • run the example using meteor

  • navigate to the server where the example runs like so: http://theserver/fffuu/madly

  • click the link to see the result in the facebook debugger

  • navigate to the server where the example runs like so: http://theserver/headly/madly

  • click the link to see the result in the facebook debugger

  • you can also try to post "http://theserver/headly/madly" to facebook and see how it handles it

  • look at the example's code to see what just happened

headly's People

Contributors

ayal avatar ayalgelles avatar doctorpangloss avatar faceyspacey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

headly's Issues

Some questions

Hi @ayal

First, good job on this package. I am just having some questions on this topic. I think you might have the answer I seek.

  1. Could you tell me the difference or advantage add the header on the server side rather than client side? I am really new in this topic. Would love you to fill out some blanks in my head.
  2. Do you happen to know in what order for connectHandler(WebApp) to handle incoming request? What if Iron router handle it before this package?(I am assuming the order matters for connectHandler)

Thank you for the package. Love to hear back from you.

attributes on <head> not supported

Great lib!

In order to a custom object (not just "og:type"=websites), a prefix attribute is required on the head, but Meteor doesn't appreciate having on by default, and headly fails to inject it like the other meta tags.

Any clues on how it'd be possible to have Facebook gets the prefix attribute of the head element as specified in the open-graph examples?

Fiber not defined

Hi, I use headly with Meteor 6.4 by add file headly_server.js to server folder (I dont user meteorite) and config same your sample code. But it dont work. Please help !

ReferenceError: Fiber is not defined
at Object.handle (app/server/headly_server.js:18:3)
at next (C:\Program Files (x86)\Meteor\lib\node_modules\connect\lib\proto.js
:190:15)
at Object.Oauth._middleware (app/packages/oauth/oauth_server.js:80:7)
at app/packages/oauth/oauth_server.js:68:13

Code from mrt is bugged

The code hosted at Atmosphere is bugged.

I've did mrt add headly and the line 11 of downloaded code is:
Meteor.headly._options = Meteor.headly._options;
instead of
Meteor.headly._options = options || Meteor.headly._options;
which is the correct version.

Spiderable compatibility

The spiderable meteor package makes the site indexable by search engines using phantom-js.

Once activated, FacebookExternal hits gets served with the spiderable-generated stuff, not the Headly Meta. What would be the most elegant way to have both packages play nicely?

PS: I also had troubles with MRT, so I use Headly_server.js directly, if that makes any difference.

having issue in fibers/futures.js using meteor 0.7

I'm getting the following error:

=> Running Meteor from a checkout -- overrides project version (0.7.0.1)

[[[[[ ~/Meteor/emilio-television ]]]]]

=> Meteor server running on: http://localhost:3000/
W20131226-02:49:00.948(-8)? (STDERR) /Users/jamesgillmore/.meteorite/meteors/meteor/meteor/cbde5bd4875524f3ade7f3baef417a43ec1b9474/dev_bundle/lib/node_modules/fibers/future.js:173
W20131226-02:49:01.048(-8)? (STDERR)                        throw(ex);
W20131226-02:49:01.048(-8)? (STDERR)                              ^
W20131226-02:49:01.058(-8)? (STDERR) TypeError: Cannot call method 'use' of undefined
W20131226-02:49:01.059(-8)? (STDERR)     at Package (packages/headly/headly_server.js:18)
W20131226-02:49:01.059(-8)? (STDERR)     at Package (packages/headly/headly_server.js:42)
W20131226-02:49:01.059(-8)? (STDERR)     at packages/headly.js:61:4
W20131226-02:49:01.060(-8)? (STDERR)     at packages/headly.js:68:3
W20131226-02:49:01.060(-8)? (STDERR)     at /Users/jamesgillmore/Meteor/emilio-television/.meteor/local/build/programs/server/boot.js:155:10
W20131226-02:49:01.060(-8)? (STDERR)     at Array.forEach (native)
W20131226-02:49:01.061(-8)? (STDERR)     at Function._.each._.forEach (/Users/jamesgillmore/.meteorite/meteors/meteor/meteor/cbde5bd4875524f3ade7f3baef417a43ec1b9474/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
W20131226-02:49:01.061(-8)? (STDERR)     at /Users/jamesgillmore/Meteor/emilio-television/.meteor/local/build/programs/server/boot.js:82:5
=> Exited with code: 8
=> Meteor server restarted

Issue with Meteor 0.8

TypeError: Cannot call method 'indexOf' of undefined
at packages/headly/headly_server.js:29
at packages/underscore/underscore.js:184
at Array.some (native)
at .some..any (packages/underscore/underscore.js:233)
at Function..find..detect (packages/underscore/underscore.js:183)
at Object.Package as handle
at next (/home/traveldiary/www/traveldiary/releases/20140423104650/bundle/programs/server/npm/webapp/main/node_modules/connect/lib/proto.js:190:15)

deps-extensions is deprecated

Result:

TypeError: Cannot set property 'add_reactive_variable' of undefined
at app/packages/deps-extensions/deps-extensions.js:16:35
at app/packages/deps-extensions/deps-extensions.js:117:2
at /Users/.../.meteor/local/build/server/server.js:298:12
at Array.forEach (native)
at Function..each..forEach (/Users/.../.meteorite/meteors/meteor/meteor/9bb2b5447e845c4f483df5e9b42a2c1de5ab909b/dev_bundle/lib/node_modules/underscore/underscore.js:78:11)
at run (/Users/.../.meteor/local/build/server/server.js:239:7)
=> Exited with code: 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.