You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Greg Chabala <gr...@gmail.com> on 2024/01/24 03:49:01 UTC

Configuring canonical URL link elements for maven-site-plugin generated pages

I'm trying to improve the search engine optimization of my project's
maven-site-plugin generated website by following some best practices. I'm
already using sitemapxml-maven-plugin to produce a sitemap for search
engines.

I'd like to configure a canonical URL link element for each page as well,
but I don't see any hint of such a thing existing in the documentation. I
know it's relatively easy to insert arbitrary elements in the header of ALL
pages, like analytics code, but it seems like adding a unique element to
the header of every page is more challenging, and might need to be
supported directly by the generator.

Is anyone doing this sort of thing? Short of making code changes to
maven-site-plugin and possibly every plugin that generates reports, I think
I might need to insert the canonical URL link elements by parsing the
generated HTML after the fact.

Greg Chabala

Re: Configuring canonical URL link elements for maven-site-plugin generated pages

Posted by Greg Chabala <gr...@gmail.com>.
Only for the Fluido skin, eh?

In the meantime I've hacked together a beanshell monstrosity to add the tag
to any pages that are missing it, which may end up becoming the basis for a
custom plugin.

Re: Configuring canonical URL link elements for maven-site-plugin generated pages

Posted by Michael Osipov <mi...@apache.org>.
If you use the Maven Fluido Skin /site/body/head is passed to Velocity's RenderTool with '#eval()' and eventuall VTL markup will be rendered. Logically, you should have access to all context attributes including the HTML page name and all other stuff.

Give it a try.

M

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org