the hashtag a scuba masters yeah and
today’s topic is all about JavaScript so
let’s get started alright root asks us
on Twitter
when using the rails asset pipeline for
caching what status code do we give the
old asset Googlebot crawls these stale
assets which we currently have 404 do we
410 them instead or do we keep them
alive for a couple of months what do you
think I don’t really know what a rails
asset pipeline is marketing Ronnie tell
us more to be fair it doesn’t really
necessarily matter to this specific
question because it’s pretty much the
same for every assets that you’ve got
and that you might update at some point
the way our asset pipeline however is a
way for rails to process and pre-process
your your assets as you have them in
development for the production website
so it’s basically like an automatic
pipeline of dealing with your assets in
your rails application but what it boils
down to is you have old assets you
eventually have a new version of your
website and then you have new assets
like some old JavaScript some previous
version of your CSS and images that
you’ll no longer having on your page
stuff like that right so how do you deal
with that well you just keep it around
for a while until we recrawl your actual
HTML content and then we get the new
assets afterwards but because of caching
we try to make it so that we can crawl
and index your page as quickly as
possible but that might mean that we’re
going to keep using outdated URLs and if
you fall for them then we’re just gonna
end up with broken renders in between
and that’s something you probably want
to avoid all right so better to keep
them around for a while
and you can use your server logs to
figure out when we stop asking for these
assets and then just fully remove them
cool our next question comes from
Michael Michael is asking if in
pre-rendering can you skip or replace
irrelevant content like JavaScript
generated SVG bar graphs or anything
else that this Java generated really
from my point of view you should include
everything as much as possible so that
whenever Googlebot accesses your pages
it sees the full content does does that
kind of match yeah I’m not really sure
like with pre-rendering do they mean
yeah so they can either I mean so
pre-rendering really is just running
your JavaScript on the server side once
whenever the content changes and then
deploying the static assets to everyone
in this case no you do not skip things
but if you mean dynamic rendering where
you would basically just give different
content to the users versus crawlers
then even then I wouldn’t skip it cool
ok so include everything our next
question comes from Graham Graham asks
on Twitter if your site has a chat
function that rewrites the title tag for
notifications to the visitor how do you
or the app supplier prevent Google from
indexing the javascript rewritten
version of the title tag you don’t I
would say no so as we are rendering the
page we are picking up written titles so
in that case whoops well you could do is
you could hide or delay the chat behind
the user to action because Googlebot
doesn’t interact with things so if you
have to click on the chat button first
and then the chat pops up and then
changes the title I think that would be
one way of dealing with this properly
Michael is asking or asking again in
pre-rendering can I still use JavaScript
inside the rendered output
it’s like JavaScript that generates
minor content or layout changes or like
anything that isn’t really heavy I
ajax.request yeah definitely so with
pre-rendering you’re basically
regenerating those pages ahead of time
and serving all of that to you
and it’s perfectly fine to have some
JavaScript elements in there as well I
think from a user point of view that
makes sense anyway because sometimes you
can serve content very quickly if it’s
pre-rendered and you can use JavaScript
to add interactive elements and that’s
perfectly fine to make sense so you
don’t have to strip out all of the
JavaScript if you pre render your pages
absolutely it’s also if you do pre
rendering and then use something that is
called hydration that’s basically what
you are aiming at you have all the
content pre rendered and then you use
JavaScript to enhance it into a single
page web app so for instance that is
perfectly okay it’s just about giving
the content to the user as quickly as
possible so it sounds like JavaScript
and SEO are gonna be with us for a while
again I do think so yes yeah wow that
sounds pretty cool so one of the things
I keep hearing from people is like is
pre rendering or dynamic rendering is
that ever gonna go away do I still have
to bother with all of that yes this
question comes up a lot so fundamentally
it will not necessarily go away entirely
maybe except for dynamic rendering
dynamic rendering is a workaround so we
hopefully do not have to keep that
around for much longer but server-side
rendering and pre-rendering are actually
very fundamentally useful concepts
because they give the users and crawlers
the content quicker right it’s HTML we
can pass that as it comes in javascript
needs to be parsed and executed to
generate the content so we cannot
basically stream the content on the
browser side and we don’t have to we
have server-side rendering available Wow
yeah it sounds like there’s still a lot
to do maybe we should do separate
YouTube videos for that what do you
think mine it’s a great idea and one we
already have if you are checking out
this channels playlist you’ll see that
we have a series called JavaScript SEO
already it has a bunch of episodes that
are covering many different topics
already but we are working on more
episodes so I guess subscribe to this
channel to stay tuned for more yeah that
sounds awesome and feel free to continue
submitting your questions using the
hashtag Google webmasters all right
thanks for watching and see you next
time
bye