Double slash // in the URL for archives

I’m attempting to migrate my blog from wordpress to Grav and have noticed that links for the archive pages are double-slashed. You can see it in my test environment.

Is this standard for Grav, or have I misconfigured something?

Looks like there’s an unnecessary slash in one of your templates. Check the template that outputs the list. Is it a plugin or a theme? Is it your own or some 3rd party?

  • I can reproduce the issue using a fresh skeleton ‘Blog Site’ install, when the website is not in the root of the domain. For example: http://localhost/grav/site-blog//archives_month:aug_2017

    OP’s website is also not in the root of the domain.

    I believe the url is still valid. Not sure if this can cause any issues anywhere, like SEO or crawlers.

  • Also, while the site is not in the root of the domain, the archive parameter is not in the canonical meta tag: <link rel="canonical" href="http://localhost/grav/site-blog/" />
    I think it should contain the parameter, because different content is returned. The canonical should differentiate between different urls returning the same content.

1 Like

Interesting! I moved everything into the root folder and the double-slash is now gone.

I’m still learning Grav (I have over 15 years of wordpress to be cleansed of) and the templating has thrown me for a loop several times so can anyone tell me which specific file would be responsible for outputting that additional slash?

Furthermore, the archive pages are still not outputting the full URL for the canonical meta tag.

Twig templates are a large part of any Grav theme. Which theme are you using?

In the current default theme ‘Quark’ there’s this template user\themes\quark\templates\partials\archives.html.twig which uses the theme variable base_url but it looks OK to me.

NB See the section in the Grav docs about debugging & logging and enable the Grav Debug Bar. Then output any Twig or theme variable in a template to the Debug Bar using the Twig dump command, e.g. {{ dump(base_url) }}.