Coder Social home page Coder Social logo

Comments (7)

knalli avatar knalli commented on May 18, 2024

Short, more later: so you know
http://www.yearofmoo.com/2012/11/angularjs-and-seo.html ?

from angular-translate.

0x-r4bbit avatar 0x-r4bbit commented on May 18, 2024

I think we should ask the awesome @cburgdorf what he thinks about that. So,
Chris?

from angular-translate.

cburgdorf avatar cburgdorf commented on May 18, 2024

Ok, as my wife turned 30 just today, I'm faced with some time constraints. So here is the quick and dirty guide on what to do:

  1. setup grunt-html-snapshot to create snapshots of all pages of your site. Currently you need to list each page that should be saved (as it can be seen here: https://github.com/cburgdorf/couch-website/blob/master/Gruntfile.js#L16) With a future improvement of the grunt task, the task could spider the site itself to figure out all pages to take snapshots from. (Patches anyone?)
  2. Make sure 1.) is part of your release step and the snapshots are stored among all the other files that usually go into your dist folder. We currently save all snapshots into the root level of our dist folder so that we have files like snapshot____de-de_about.html directly placed next to the index.html file.

See: https://github.com/cburgdorf/couch-website/blob/release/snapshot____de-de_about.html

3.Then configure your webserver to spit out those templates according to the hashbang spec. E.g. www.mypage.com/#/foo will be requested from your server as www.mypage.com/?_escaped_fragment_=/foo. So just configure your webserver to hand out the correct snapshot when it sees such a request.

  1. Also add <meta name="fragment" content="!"> so for pages that don't have a hashbang in it's URL but still depend on client side js to be functional. That's usually the root page of your side. With this meta tag we make sure that the google also requests www.mypage.com as www.mypage.com?/_escaped_fragment_= even so it has no hashbang itself.

Hope that helps.

from angular-translate.

0x-r4bbit avatar 0x-r4bbit commented on May 18, 2024

Thanks for you input Chris!

from angular-translate.

0x-r4bbit avatar 0x-r4bbit commented on May 18, 2024

Maybe I'm wrong, but it looks like there's nothing angular-translate can really do to help out there, right? Isn't it more an application-level thing, where the app has to figure out which language should be used and then tell angular-translate about it?

So my actual question, with the given construct and tips @cburgdorf gave us here, is it possible to generate these snapshots in different languages using angular-translate or not? And if not, is there anything you need from angular-translate to get this working? If so, lemme know so I can implement what you need and make it a feature in 1.0 release.

from angular-translate.

cburgdorf avatar cburgdorf commented on May 18, 2024

I must agree that I don't see how angular-translate could help here. The different languages should be accessible via URL (e.g. mySite.com/en/foo vs mySite.com/de/foo) and then be saved via grunt-html-snapshot individually (e.g. https://github.com/cburgdorf/couch-website/blob/master/Gruntfile.js#L16).

from angular-translate.

0x-r4bbit avatar 0x-r4bbit commented on May 18, 2024

This is exactly what I thought too! So I will close this for now. We can reopen this one, if needed. @Skivvies nevertheless, keep us up-to-date with your experiences!

from angular-translate.

Related Issues (20)

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.