psmb / Psmb.Ajaxify

Lazily load any content on your Neos site
GNU General Public License v3.0
13 stars 9 forks source link

Google crawler follows the `?ajaxPathKey=` urls and index them #2

Closed jobee closed 5 years ago

jobee commented 5 years ago

Hey @dimaip is there any chance to easily modify the response header in your Psmb.Ajaxify:Renderer ? I would suggest X-Robots-Tag: noindex, follow, what do you think?

jobee commented 5 years ago

I came up with this workaround, please let me know whats your thoughts on that. Was there a reason why you have skipped the default fusion response head?

# Override.Ajaxify.fusion
root.ajaxify.renderer = Psmb.Ajaxify:RendererWithProperResponseHead

prototype(Psmb.Ajaxify:RendererWithProperResponseHead) < prototype(Neos.Fusion:Http.Message) {
    httpResponseHead.headers {
        X-Robots-Tag = 'noindex, follow'
    }
    content = Psmb.Ajaxify:Renderer
}
dimaip commented 5 years ago

Makes sense! I think it would be good to enable it by default. Could you create a PR?

jobee commented 5 years ago

I will provide a PR, yes. Any objections on the prototype naming Psmb.Ajaxify:RendererWithProperResponseHead ?

dimaip commented 5 years ago

Sounds a bit weird :) Maybe Psmb.Ajaxify:UnindexedResponse?

Or you could just do:

root.ajaxify.renderer = Neos.Fusion:Http.Message {
    httpResponseHead.headers {
        X-Robots-Tag = 'noindex, follow'
    }
    content = Psmb.Ajaxify:Renderer
}
jobee commented 5 years ago

you are right, no need for an extra prototype

dimaip commented 5 years ago

In general having an extra prototype allows for safer extensibility at a later point, don't know if it's really justified here... Though one might want to change the tag to e.g. noindex, nofollow for example, and it would be better to override it based on prototype, and not just fusion path (root.ajaxify.renderer...)...

jobee commented 5 years ago

ah good point, extra prototype then PR is created