Single-page JS websites and SEO

0 votes

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 nothing more) and letting the client handle all of the HTML generation stuff. The problem with this "pattern" is the lack of search engine support. I can think of two solutions:

  1. When the user enters the website, let the server render the page exactly as the client would upon navigation. So if I go to http://example.com/my_path directly the server would render the same thing as the client would if I go to /my_path through pushState.
  2. Let the server provide a special website only for the search engine bots. If a normal user visits http://example.com/my_path the server should give him a JavaScript heavy version of the website. But if the Google bot visits, the server should give it some minimal HTML with the content I want Google to index.

The first solution is discussed further here. I have been working on a website doing this and it's not a very nice experience. It's not DRY and in my case I had to use two different template engines for the client and the server.

I think I have seen the second solution for some good ol' Flash websites. I like this approach much more than the first one and with the right tool on the server it could be done quite painlessly.  Can you think of any better solution?

Mar 2, 2022 in Digital Marketing by Kichu
• 19,040 points
663 views

1 answer to this question.

0 votes
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)
answered Mar 4, 2022 by narikkadan
• 63,600 points

Related Questions In Digital Marketing

0 votes
0 answers

Design and SEO for a single page dynamic website with AJAX

I designed a website in which the ...READ MORE

Mar 12, 2022 in Digital Marketing by Kichu
• 19,040 points
545 views
0 votes
0 answers

SEO with single page application

I built a node.js social networking web ...READ MORE

Mar 4, 2022 in Digital Marketing by Kichu
• 19,040 points
502 views
0 votes
0 answers

SEO: Why "indexed pages" in Webmaster Tools and the command "site:" gives so much difference?

"Indexed URLs: 305,509"webmaser shows this when i ...READ MORE

Mar 2, 2022 in Digital Marketing by Kichu
• 19,040 points
455 views
0 votes
1 answer

How to remove home page title in Yoast SEO?

Here, you have two possibilities. You can ...READ MORE

answered Mar 4, 2022 in Digital Marketing by narikkadan
• 63,600 points
3,051 views
0 votes
1 answer

pushState and SEO

Google suggests meta tags for those who ...READ MORE

answered Mar 12, 2022 in Digital Marketing by narikkadan
• 63,600 points
837 views
0 votes
1 answer

How to set meta tags using Angular universal SSR and ngx-seo plug-in?

first Install the plug-in with npm i ngx-seo ...READ MORE

answered Feb 11, 2022 in Others by narikkadan
• 63,600 points
2,202 views
0 votes
1 answer

AngularJS SEO - Once and for all

java script cant be or wont be ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,600 points
640 views
0 votes
0 answers

Angular and SEO indexing

app.config(["$routeProvider", function($routeProvider) { $routeProvider .when("/", ...READ MORE

Feb 14, 2022 in Others by Kichu
• 19,040 points
302 views
0 votes
1 answer

Yoast SEO: remove og:description and twitter:description

add_filter("wpseo_opengraph_desc", "remove_yoast_og"); add_filter("wpseo_twitter_description", "remove_yoast_og"); function remove_yoast_og($description) { ...READ MORE

answered Mar 1, 2022 in Digital Marketing by narikkadan
• 63,600 points
683 views
0 votes
1 answer

Facebook Graph API SEO Comments and Profanity Filter

actually there is no way  to be ...READ MORE

answered Mar 1, 2022 in Digital Marketing by narikkadan
• 63,600 points
1,013 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP