4

I am building a open blog website which users can create posts. Whenever a user creates post, it is being inserted to database and fetching its heading from database in the main page. Whenever a visitor clicks the heading of some post, it goes to a URL like

example.com?subject=places_to_visit_in_new_york

Also, today I generated a sitemap and it doesn't include those posts because they are not real pages and they are being called via a PHP function. I just sent my sitemap to Google and so far Google isn't indexing posts. (Which I understand.)

I checked other forums and their URLs are like

example.com/places_to_visit_in_new_york

Should my page be creating a new file for each post or can I keep going using a parameter for SEO?

If you tell me I can keep going this way, how can I understand if Google indexes posts? If a new file must be created for each post,can you tell me how to do it?

Stephen Ostermiller
  • 99,822
  • 18
  • 143
  • 364
dudi
  • 43
  • 3

3 Answers3

3

The url example.com/places_to_visit_in_new_york can be created dynamically depending on the framework/language your website is based on. This means that you don't have to create separate files for seperate urls just like using the query string format.

Consider the example of Wordpress where you have the option of choosing between multiple url patterns under the permalinks section

  1. example.com/posts?id=1
  2. example.com/my-new-post

The most preferred format is the second one

The reason can be understood by reading this article Keep a simple URL structure

A site's URL structure should be as simple as possible. Consider organizing your content so that URLs are constructed logically and in a manner that is most intelligible to humans (when possible, readable words rather than long ID numbers). For example, if you're searching for information about aviation, a URL like http://en.wikipedia.org/wiki/Aviation will help you decide whether to click that link. A URL like http://www.example.com/index.php?id_sezione=360&sid=3a5ebc944f41daa6f849f730f1, is much less appealing to users.

However query strings in url are also common when it comes to filtering your content or pagination. But keep in mind that Google crawls and indexes content on both url formats unless there is content duplication or some other issue.

Shahzeb Qureshi
  • 591
  • 2
  • 9
1

No one can know for sure how your HTML documents are delivered (unless they have backend access to your server).

The URL can give a hint, but there is no guarantee that this hint is accurate. /foobar.php and /foo?bar could retrieve static files, /foobar.html and /foobar could retrieve dynamically generated files. But even if a search engine would know, it doesn’t matter: what counts is the document, not how it’s generated.

URLs: Search engines can crawl/index URLs with mandatory query components perfectly fine. The primary reason to prefer path-based URLs is that they might be more user-friendly/beautiful.

Sitemap: If you have a sitemap, and if you want the blog posts to get indexed, there is no reason not to add them to the sitemap.

unor
  • 21,919
  • 3
  • 47
  • 121
0

The path portion of the URL always refers to a unique page/post in WP. When a user requests http://example.com/my_post, WP matches the path to a unique database ID and then creates the file on the fly similar to what you are doing. However, as others have mentioned, a querystring/parameter is not user friendly.

The WP sitemap can be both a Google and user friendly URL/path for each post and hide the actual querystring from both Google and users.

Not a criticism, but simply wondering... If you are trying to write a new page using MySQL data, why not use something like WordPress or Drupal that already has lots of testing, rather than reinvent the wheel?

Trebor
  • 3,300
  • 10
  • 25