Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Double slash // in the URL for archives

Started by Dorian Jepsen 3 years ago · 4 replies · 501 views
3 years ago

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?

3 years ago

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?

3 years ago
  • 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
last edited 05/20/23 by pamtbaau
3 years ago

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.

3 years ago

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) }}.

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago