getgrav / grav-plugin-sitemap

Grav Sitemap Plugin
https://getgrav.org
MIT License
42 stars 42 forks source link

Set Default values, use link instead of permaLink #28

Closed mhauri closed 7 years ago

mhauri commented 7 years ago
flaviocopes commented 7 years ago

What's the reason behind Use $page->link(true) instead of $page->permaLink() ?

mhauri commented 7 years ago

Didn't tested it trough, but noticed a Problem in my Blog.

As Example in my Blog I have a folder 01.blog in which i have my blog posts. When navigated over the blog they are shown asexample.com/this-is-my-blog-post But in the Sitemap the link is shown as example.com/blog/this-is-my-blog-post

Also the Homepage itself contains the /blog folder in the sitemap. So example.com is shown as example.com/blog in the sitemap.

Chouchen commented 7 years ago

$page->canonical() could be a solution, right ?

lulis commented 7 years ago

This patch is really needed to make the grav sitemap plug-in functional. Thanks @mhauri !

I've patched my local install manually. This patch will be merged anytime soon? Sorry about this dumb question, but the timeline above really make me confuse: image

Thanks a lot (and sorry for any inconvenience here), guys!

rhukster commented 7 years ago

I also think it should be canonical as it supports languages.

rhukster commented 7 years ago

FYI: link code is simply:

public function link($include_host = false)
    {
        return $this->url($include_host);
    }

Canonical code is:

    public function canonical($include_lang = true)
    {
        return $this->url(true, true, $include_lang);
    }

so $page->link(true) is actually the same as $page->canonical(false) but actually having $include_lang true is going to give better results for multi-lang setups.