DEV Community

はるはる Haruharu
はるはる Haruharu

Posted on

For those who want to create a site to dynamically display GAS data using Ajax

As the title suggests, this information is for those of you who are planning to create such a site and register it with search engines, or for those of you who are using Ajax to retrieve and display data, but are having trouble getting the content to be visible in the search engine's Webmaster Tools.

I hope this information will be helpful to those of you who are in the process of gathering information!

What is the cause?

Depending on the response format, GAS often uses

ContentService.createTextOutput();
Enter fullscreen mode Exit fullscreen mode

I think this is used frequently.
Let's say you use this with Ajax(); to retrieve and display content, escaping it, and creating a site. In that case, when using the Search Console, you may see

Image description

and

Are you being blocked by robots.txt?

In conclusion, it is possible that creating a site that directly displays GAS data using Ajax for the purpose of registering with search engines is not recommended.
In other words, the only solution may be to ensure that it is not affected by robots.txt, but I would like to refrain from writing about that method here.

In other words, that's the specification.

Why don't you tell us the solution even though you know the cause?

That's because it hasn't been officially confirmed. If we can't confirm the meaning of robots.txt, it could lead to a major disaster. It's just speculation, but it might be to deal with the possibility of important information being crawled due to a user's inadvertent script settings, considering the domain that manages many scripts (script.google.com). From that perspective, if it's on a per-script basis, it may also be up to each site operator's judgment...

Since it's not good to say random things in this kind of article, please read the conclusion.

That was the knowledge article.

Personally, until the significance of this robots.txt is disclosed officially,

I think it's better to refrain from creating it for this purpose.

Even if you do create it,
I think it's good to use it for sites that don't need to be visible to search engines (such as a database search screen) because it is visible to people in the normal browser.

If there is official information or other information about this, please let me know in the comments.

Top comments (0)