Page 1 of 1

CGBlog URL without root_url

Posted: Wed Sep 25, 2019 6:05 pm
by w00t
Hello.
Help me pls, how I can get CGBlog urls without root_url? Cuz output of the {$entry->detail_url} is http://192.168.0.101/2019/09/test.html, but I need only the second part of the url, without a website address or ip, I mean only "/2019/09/test".

Re: CGBlog URL without root_url

Posted: Wed Sep 25, 2019 7:11 pm
by Rolf
Dirty fix, but it will do the trick...

Code: Select all

{$entry->detail_url|replace:'http://192.168.0.101':''}

Re: CGBlog URL without root_url

Posted: Fri Sep 27, 2019 11:27 am
by w00t
Thank yo so much for your try to help me Rolf, but unfortunately I realized that the problem seems to be not the case. No matter if I even clean up the link from root_url and place it to template everytime root url would be added to final link. Damn, I don't underdtand why... ???

Re: CGBlog URL without root_url

Posted: Sat Sep 28, 2019 9:54 am
by velden
First question would be: why do you need it?

Second question: is the 'root_url' part really not removed from the link? (check the page's html source, NOT using user browser dev tools)

Further, you may check for the meta tag <base ...> in the head section of your template. Note that it comes by default using the {metadata} tag (https://docs.cmsmadesimple.org/tags/cms ... tadata-tag).
You can use a parameter to prevent the tag from being added automatically though you're then probably working around another problem.


I don't expect you actually will be hosting a blog using an internal ip address as the main 'domain'. So it may be better to configure your test environment to be more representative to production. For example adding a domain - ip address relation in your local hosts file.