Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Include version number in meta generator tag #2721

Merged
merged 1 commit into from
Mar 9, 2022

Conversation

emteknetnz
Copy link
Member

@emteknetnz emteknetnz commented Feb 16, 2022

Issue #2708

Will require this PR to be merged first

@emteknetnz emteknetnz changed the title ENH Include version number in meta generator tag NEW Include version number in meta generator tag Feb 16, 2022
@emteknetnz emteknetnz force-pushed the pulls/4/meta-version branch 2 times, most recently from 5dcdd8a to f228bc8 Compare February 16, 2022 05:59
* @config
* @var bool
*/
private static $show_meta_generator_version = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just keep tho old behavior and not output the meta tag if `meta_generator' is blank?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That behavior is still there, if you config private static $meta_generator to a blank string then there won't be a meta tag for generator

i.e.

    public function MetaComponents()
...
        $generator = $this->getGenerator();
        if ($generator) {
            $tags['generator'] = [
...
    }

    private function getGenerator(): string
    {
        $generator = trim(Config::inst()->get(self::class, 'meta_generator'));
        if ($generator === '') {
            return '';
        }
        if (self::config()->get('show_meta_generator_version')) {
        ...
    }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just don't understand what kind of user would say "I don't want the version number there, but I'm fine advertising the site uses Silverstripe CMS".

My gut feeling is the vast majority of users who are bothered by the version number will want to remove the entire meta tag.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably very few users. However private static $meta_generator = 'Silverstripe CMS'; is currently a configurable string, so we do support changing this to something else e.g. 'CMS from Mars'.

If people want to report this as a different CMS for whatever reason, then I can see why they wouldn't want to include the version number

I'm not hugely attached to having these two things separately configurable, though I also don't see it as much extra hassle

code/Model/SiteTree.php Show resolved Hide resolved
Copy link
Contributor

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry ... meant to reject.

Copy link
Contributor

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested it locally and it works fine. I hacked my composer.lock file to test that the version is being picked up properly.

There's the slight question about what to do with "4.x-dev". Since this doesn't match the expected regex format, it just comes back with nothing. The help menu in the CMS renders "4.x".

The behaviour in this PR is pretty defensible and I don't have any beef with it. Just think it's worth pointing out this is happening.

Copy link
Contributor

@maxime-rainville maxime-rainville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the composer file needs to be updated to require framework ^4.11 since we rely on the new API being present.

@emteknetnz
Copy link
Member Author

emteknetnz commented Mar 8, 2022

it just comes back with nothing

That was intentional, some people will be running forks of framework, don't want those being reported. I'll add an inline note about this

composer.json has the ^4.11 requirement

@emteknetnz emteknetnz force-pushed the pulls/4/meta-version branch from 58a2dfb to 27718ec Compare March 8, 2022 00:52
@maxime-rainville
Copy link
Contributor

Framework PR has been merged which should make this PR green. Just restarted the build

@emteknetnz emteknetnz merged commit 3b62336 into silverstripe:4 Mar 9, 2022
@emteknetnz emteknetnz deleted the pulls/4/meta-version branch March 9, 2022 01:48
3Dgoo pushed a commit to 3Dgoo/silverstripe-cms that referenced this pull request Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants