meanjs / mean-seo Goto Github PK
View Code? Open in Web Editor NEWSEO Solution for MEAN.JS applications using PhantomJS.
SEO Solution for MEAN.JS applications using PhantomJS.
TypeError: 'undefined' is not a function (evaluating 'this.window.console.error.bind(this.window.console)')
Is it possible to use Pushstate instead go hash bang ?
Hi - fantastic module, thanks. We found a minor problem when running on a Linux box. Line 14 of lib/mean-seo.js is this:
Cache = require('./Cache');
On a mac that worked fine but when we uploaded the code to an EC2 box it failed to run. Changing the capitalization to this works:
Cache = require('./cache');
Can you amend it so an npm install on a fresh server works out of the box?
many thanks
how do i crawl a website with valid SSL certtificate. I updated the phantomjs to the latest version and added the required parameters in childArgs array in browser.js file like this-
childArgs[2] = 'ssl-protocol=tlsv1';
childArgs[3] = '--ssl-certificates-path=/path/to/SSL/certificate';
childArgs[4] = '--ignore-ssl-errors=true';
I am getting a 'unable to access network error'..
what am i doing wrong here?
Hi,
I've been trying to install mean-seo and it never gets triggered. By digging into the code I found that
var escapedFragment = req.query.escaped_fragment;
is always empty.
In general, req.query is always empty.
Note: I put the app.use(seo...) at the right place, just before the routers initialization.
What seems to be the issue here in the middleware?
Please update Phantom to 2.x cause Phantom 1.x doesn't have Function.prototype.bind
so we cant run Angular 1.5+ with it
Error: [$injector:modulerr] Failed to instantiate module ng due to:
TypeError: 'undefined' is not an object (evaluating 'Function.prototype.bind.apply')
Maybe I'm not reading the spec correctly, but it says that for HTML5 pushstate URLs you get pinged with "?escaped_fragment=". Notice that the get parameter has no value, it's just an empty string.
As such, when I was testing this out on my app, I tried this:
$ curl "http://localhost:3000?_escaped_fragment_="
But this didn't trigger the SEO middleware.
Digging into the source, I found that you do this in lib/mean-seo.js:39:
return function SEO(req, res, next) {
var escapedFragment = req.query._escaped_fragment_;
//If the request came from a crawler
if (escapedFragment) {
/* do SEO stuff */
} else {
next();
}
}
For my CURL, that comes up as falsey.
Shouldn't the if conditional rather test for escapedFragment !== undefined
?
For example crawler requests page /categories?sort=name&_escaped_fragment_=
but Mean Seo passes to Phantom /categories
.
As result wrong rendered page!
when i go to url
http://localhost:3000/?_escaped_fragment_=/#!/signin
the resulting page source is showing
<section style="min-height:500px"> <section class="container">
<!-- uiView: --><section data-ui-view="" class="ng-scope"><section data-ng-controller="HomeController" class="ng-scope">
<span ng-show="false" class="ng-hide">homepage content</span>
</section>
and not showing signin page content . please correct me if i am going wrong.
Error code is as follows:
at ChildProcess.exithandler (child_process.js:658:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
Error: Command failed: /home/agepath/node_modules/mean-seo/node_modules/phantomjs/lib/phantom/bin/phantomjs: 4: /home/agepath/node_modules/mean-seo/node_modules/phantomjs/lib/phantom/bin/phantomjs: Syntax error: Unterminated quoted string
Would be great to incorporate WaitFor.js (https://github.com/ariya/phantomjs/blob/master/examples/waitfor.js) into mean-seo.
This Phantom.js script waits until the test condition is true or a timeout occurs.
Useful for waiting on a server response or for a ui change (fadeIn, etc.) to occur.
I'm happy to look into this, but just making sure someone else is not already working on this?
Hi. I build a site with mean.js and use it mean-seo for google search optimisation. How can I check work of the mean-seo? What should I do? I try use Google Webmaster tools but have {{}} and not render page after request to '/'.
_escaped_fragment_
option got deprecated:
https://webmasters.googleblog.com/2015/10/deprecating-our-ajax-crawling-scheme.html
How can we make it to pre-render for crawlers? (without the escaped_fragment)
In my local development environment, i can see the cache folder being created in mean-seo folder.
But on production when i try to hit the url eg, xyz.com/?escaped_fragment=about i get server error page.
What is wrong?
Hi,
is this module compatible with Express without using Mean ?
A pull request with a fix for this problem was merged to master, but later the bug was reintroduced. Could the redundant slash be removed again?
If I'm mistaken please correct me but isn't app.use(app.router)
removed from Express 4.
https://github.com/visionmedia/express/wiki/Migrating-from-3.x-to-4.x
And if I'm not mistaken again, MEAN is using Exp. 4
Therefore there is no line of app.use(app.router)
then where should I put app.use(seo...)
?
app.use(seo({
cacheClient: 'disk', // Can be 'disk' or 'redis'
cacheDuration: 2 * 60 * 60 * 24 * 1000, // In milliseconds for disk cache
}));
// app.use(app.router) will be below this line
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.