Jump to content
TNG Community
PeterC66

How to enable Google indexing of a site requiring login

Recommended Posts

PeterC66

I have been chasing a problem I seem to have had for some time now, namely that Google was not indexing my TNG pages, for example, https://www.hcnhistory.org.uk/tng/getperson.php?personID=P4755&tree=hwn

I use the TNG Create Site Map Mod (for which thanks), and when I first set it up some years ago everything seemed to work fine.

I have now worked through and solved issues with my robots.txt file and WordPress adding a noindex to all non-WordPress pages.  Now I think I am facing the problem that I now require Login to access TNG pages, so Google cannot see them. (The reason I have switched to requiring long is so that I can publish some otherwise restricted documents.)

Using a general Google search I found something which basically says that you can't get Google to index behind a login but does point to some way to resolve it.  Has anyone else tackled and/or solved this?

Share this post


Link to post
Share on other sites
Katryne

You can't. If you close your site to non-connected guests, you close it to search engines. Only what is left as public pages (ie : home page and some stats) will be available to be searched and found.

Share this post


Link to post
Share on other sites
PeterC66

I think I have found a solution that suits my needs, and hopefully will give enough access to search engines to be able to index the person and family pages.

I have created a mod that:

  • in checklogin.php: if a global ($allowrestrictedview) is set, if a user is not logged in it sets another global ($dorestrictedview) to true rather than force a login
  • this is done for both getperson.php and familygroup.php, enabling me to restrict what each shows a user who is not logged in
  • in the restricted view I replace any showing of media and albums with a message and link suggesting the user logs in (this is the only restriction I think I need)

I have also removed all the media from the sitemap using one of the Edit Options in the Create Sitemap mod.

This seems to work OK on my WAMP system, and I have partly implemented it on my live system (hcnhistory.org.uk) to check whether and how Google's indexing works. I will report on how it goes in a few weeks.

Share this post


Link to post
Share on other sites
PeterC66
On 4/5/2022 at 3:05 PM, PeterC66 said:

This seems to work OK on my WAMP

I can now report that this solution seems to work on my live site. At first, I thought it had not because in Google Search Console I saw that all TNG pages are marked as "Discovered – currently not indexed". However, on closer inspection I see that Google is indexing the TNG pages as expected, but only very slowly.

If you search for "Charles William Attwood" then the entry on my site (hcnhistory.org.uk) should appear in the search results now that it is indexed. You can then see what the abbreviated page looks like (with its message about logging in to see media).

Maybe I need to do something to encourage Google to index more of my pages per day?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×