“Single-page” JS websites and SEO

后端 未结 9 1763
春和景丽
春和景丽 2020-11-30 16:13

There are a lot of cool tools for making powerful \"single-page\" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and no

9条回答
  •  执念已碎
    2020-11-30 16:50

    If you're using Rails, try poirot. It's a gem that makes it dead simple to reuse mustache or handlebars templates client and server side.

    Create a file in your views like _some_thingy.html.mustache.

    Render server side:

    <%= render :partial => 'some_thingy', object: my_model %>
    

    Put the template your head for client side use:

    <%= template_include_tag 'some_thingy' %>
    

    Rendre client side:

    html = poirot.someThingy(my_model)
    

提交回复
热议问题