hydephp / develop

The HydePHP Source Code Monorepo
https://hydephp.com
MIT License
13 stars 6 forks source link

[2.x] Should we add a version prefix to the generator string? #1748

Closed caendesilva closed 3 months ago

caendesilva commented 3 months ago

Both in HTML pages and the sitemap generator we have this:

<meta name="generator" content="HydePHP 1.6.0">
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" generator="HydePHP 1.6.0">

Maybe we should prefix them like this?

<meta name="generator" content="HydePHP v1.6.0">
<urlset xmlns="https://www.sitemaps.org/schemas/sitemap/0.9" generator="HydePHP v1.6.0">

I think it looks nicer, but we should check what the conventions are.

caendesilva commented 3 months ago

HTML spec states that the value is freeform, but for all CMSs I'm seeing with a quick search, noone seems to use a version prefix.

caendesilva commented 3 months ago

Got some very good recommendations by ChatGPT 4 after non-directive questioning.

Recommendation: Choose the style that aligns with your project's documentation and conventions. If you often use the "v" prefix in your versioning elsewhere, such as in documentation or software labels, go with the "v" style for consistency. If you typically do not use the "v" prefix, then omit it for simplicity.

Given these points, if HydePHP commonly uses the "v" prefix for versions, the second style is recommended for consistency. Otherwise, the first style is simpler and equally valid.

Since we use a "v" prefix pretty much everywhere, this makes sense for us to keep this the same.

On a follow up on which is most common:

The most common style for the generator meta tag, based on widespread web development practices, is to omit the "v" prefix. This is because the context usually makes it clear that the number refers to a version. Here’s the typical usage:

Rationale: Simplicity: Omitting the "v" keeps the content clean and concise. Convention: Many widely used CMSs and tools like WordPress, Joomla, and Drupal use this style in their generator tags.


Claude also favours prefixless

Both styles are acceptable, but the first option without the "v" prefix is generally preferred

This style is better for a few reasons:

  1. Consistency: It aligns with common practices in version numbering, where the "v" is often omitted in metadata and machine-readable contexts.

  2. Simplicity: It's cleaner and more concise without the extra character.

  3. Parsing: For automated tools or scripts that might read this information, not having the "v" makes it easier to parse the version number directly.

  4. Standards: Many major frameworks and CMSs use this style in their generator tags.

However, both styles are widely understood, and either would effectively communicate the generator and its version. The choice ultimately depends on your project's conventions and preferences.


Using AI like this gives good insight into what is statistically likley to be a good choice. However, since this is not a standardised format, I don't think external parsers is something we need to worry about. It's more for curious humans. And for that reason I think it could be good if we matched how we always present versions, with the prefix.

caendesilva commented 3 months ago

Another note is that many generators use just the major version (very sound for dynamic things that can have vulnerabilities), but I don't think that's useful here since there aren't that many major versions at this time...

caendesilva commented 3 months ago

Given this is mainly for human use, and a since we use the version prefix everywhere else, I'm going to go with my gut and go against the existing conventions here, and move forward with this.

caendesilva commented 3 months ago

I LOVE that I've been debating this forwards and backwards, whilst completley forgetting I already fixed this last year in https://github.com/hydephp/develop/commit/eade477e0dd713f096d5484b5dd73444a14a1e16 https://github.com/hydephp/develop/releases/tag/v1.0.0-RC.6

The reason I must have spaced on this is that this is set in a config value, so HydePHP.com has not updated fully, but new projects have this since a long time back.

So what we definitely should do is to update the sitemap generator to normalize with this. I checked, and since the generator property is not in an official sitemap spec, we can use a freeform value here too.