Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

SEO fixes when the MEAN-SEO module is used #307

Closed
wants to merge 1 commit into from
Closed

Conversation

snez
Copy link

@snez snez commented Dec 16, 2014

Fixes for various crashes when the MEAN-SEO module is used and when receiving encoded inbound links from external websites. Issues were found by inbound traffic at talentblok.com.

@apitts
Copy link

apitts commented Dec 19, 2014

@snez I wonder if you could give some further detail on this? I've just included the MEAN-SEO module and would like to see if there are issues with inbound traffic before I go live with it. Thanks!

@snez
Copy link
Author

snez commented Dec 19, 2014

@apitts sure.

For the first bit, if Google requests domain.com/?escaped_fragment=articles, phantomjs will launch and will load the application shell, render the articles section, but then ui-router will kick in and redirect to domain.com/?escaped_fragment=articles#!/ which will render the homepage. So we found that Google was caching the homepage for us for nearly the entire site. This fix will instead redirect to domain.com/?escaped_fragment=articles#!/articles when javascript is loaded so that Google will index the correct page content.

The other two bits are for when html5mode is disabled, and various links from the website are shared by email or indexed by other pages, they may be encoded. If the website receives inbound traffic from an encoded link then the front-end crashes with a white screen of death. So we make sure to decode the url before handing it to ui-router.

Also have in mind that some escaped fragment implementations, especially the ones by facebook, linkedin, twitter etc may prepend a forward slash to the path, i.e. domain.com/?escaped_fragment=/articles - this will also crash mean-seo so we use the above in combination with the following patch:
https://github.com/snez/mean-seo/blob/master/lib/mean-seo.js#L44

@apitts
Copy link

apitts commented Dec 19, 2014

Thanks very much @snez! That's very helpful. I have html5mode enabled so it sounds like I should make the changes as per your first paragraph so that Google can index pages other than the home page and also the changes as per your third paragraph to avoid that white screen of death when linked to from some external sites. I am sure this has saved me some pain.

@apitts
Copy link

apitts commented Dec 19, 2014

Just fyi - I got a linting error and added /*jshint nonstandard:true */ as per jshint/jshint#740 to resolve.

@apitts
Copy link

apitts commented Feb 11, 2015

@snez - I'm actually still having a bit of an issue with this - if you have any thoughts would love to hear them!

Please see the issue I commented on here: meanjs/mean-seo#3

@codydaig
Copy link
Member

Is this something that needs to be implemented in the 0.4.0 branch?

@lirantal
Copy link
Member

if this is SEO related is it possible to move it to that module or somewhere else? it doesn't look very organized to put it on the main application.js file

@ilanbiala @rhutchison

@codydaig
Copy link
Member

codydaig commented Aug 2, 2015

@lirantal @ilanbiala This no longer applies since we don't use the #! anymore. This PR can be closed.

@lirantal lirantal closed this Aug 2, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants