2

I have a website where besides 5 pages the main content is retrieved from the database using an ID.

https://example.com/content/page.html?id=1
...
https://example.com/content/page.html?id=100...

The content on these pages is generated dynamically using JavaScript and retrieving information from a database. In essence, is just one page (template), but the content is unique on every ID.

A URL inspection in the Google search console returns all positive results (Availability - URL can be indexed). But this part I don't understand:

URL is available to Google.

If it gets indexed and selected as canonical, it could appear in Google Search results with all relevant enhancements

Now, I don't know how to make Google index each of these pages!

2
  • 1
    The most interesting part of your question is that JavaScript handles the parameters. That may be part of the issue and it isn't addressed by Why aren't search engines indexing my content?. However other more mundane reasons may be at play too. How long has it been since you site was launched? Jan 25 at 20:21
  • I've added title as the second parameter, submitted the new link format and Requested Indexing in Google search console. I seems that Google indexed ti link in the new format
    – cat15ets
    Jan 25 at 20:39

1 Answer 1

0

I dont believe you can make Google index a URL), and even once Google knows of it, it can take a while (months) to index your site. There are some things that can help -

  1. Create and advise Google if a sitemap (see https://developers.google.com/search/docs/advanced/sitemaps/build-sitemap)

  2. Use pretty URLs. Remove the ?id= in your page and use URL reriting on the server and munge this to pull the data out the database.

To do the latter (in brief terms) Lets assume you have an ID, descr and content fields in your DB, and you run Apache.

Create a url structure like https://www.example.com/IDNo/descr

In your Apache config add the following (this is fairly common and standard in Wordpress installs. If a page does not exist it feeds it to a default page index.php -

  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.php$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . /index.php [L]

Rename/copy page.html to index.php (assuming you use php, otherwise modify as appropriate) and near the top of this script parse the $_SERVER['REQUEST_URI'] or equivalent/similar to retrieve the ID of the database page to display/merge.

You can similarly create the sitemap referencing DESCR when describing a URL.

The idea of having a description is that it helps Google know some key words of the site. Likewise, by using a pretty URL, Google can ve sure its indexing a unique page, and it doesnt need to guess if ID is part of a session or URL. Ref: https://developers.google.com/search/docs/advanced/guidelines/url-structure

2
  • 2
    I'm not sure than any of your rewrite rules will work with JavaScript powering the loading of content based on the parameter. Jan 25 at 20:22
  • It seems that adding title as the second parameter in the URL did the job. I'm going to rewrite the sitemap, request google to index them, and see what happens.
    – cat15ets
    Jan 25 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.