Preamble
Hello,
I'm trying to improve SEO of a web app built with Angular 7. Unfortunately, I can't (not allowed to) install node on the server it's being hosted on, so I cannot implement server-side rendering.
In this case, with no SSR, I've decided to go with pre-rendering.
I've tried using prerender.io
with Apache middleware, but got no results, because proxy is not enabled on the server and I'm not allowed to enable it.
Then I've decided to create a local node.js app, which will make requests to https://render-tron.appspot.com/
, save generated html
files locally (in project dist/prerender
folder).
I've configured .htaccess
to serve those pre-rendered
files to crawlers, it looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
RewriteCond %{HTTP_USER_AGENT} googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|W3C_Validator [NC,OR]
RewriteCond %{QUERY_STRING} _escaped_fragment_
# Only proxy the request to Prerender if it's a request for HTML
RewriteRule ^(?!.*?(\.js|\.css|\.xml|\.less|\.png|\.jpg|\.jpeg|\.gif|\.pdf|\.doc|\.txt|\.ico|\.rss|\.zip|\.mp3|\.rar|\.exe|\.wmv|\.doc|\.avi|\.ppt|\.mpg|\.mpeg|\.tif|\.wav|\.mov|\.psd|\.ai|\.xls|\.mp4|\.m4a|\.swf|\.dat|\.dmg|\.iso|\.flv|\.m4v|\.torrent|\.ttf|\.woff|\.svg))(.*) https://website.com/prerender/$2 [P,L]
</IfModule>
So, I've got two questions:
- When I
curl https://website.com --user-agent "Googlebot/2.1 (+http://www.google.com/bot.html)" -v $@
I'm not actually getting my pre-rendered, statichtml
page, I'm getting my Angular page, containing only<app-root></app-root>
in the body. Is something wrong with my.htaccess
? - Even if I get my
htaccess
to work, would this practice be considered cloaking? Basically the page looks exactly the same, even assets are loaded. But still, from what I've read, it may be considered cloaking.
Thanks!
json-ld
scripts to a page. Because, from what I've seen, their Rich Data Testing Tool isn't really able to parse JS.. Can you share some experience related to this? Thanks