I’m new to Kirby, but I’ve used WordPress, Expression Engine, Habari and other CM-Systems since 2004.
What is new to me, is the aspect of routing. I’ve read the docs and nearly all topics about this in the forum, but I think I’m totally missing something.
In the docs you have the example of a WordPress-like structure and this is going with c::set into config.php. But that’s not all right? Somewhere I’ve read that I must start und run a Router, but how exactly should I do this and in which subfolder? Could you please give a hint to a complete workflow for changing the urls of blog articles from
Yes I’ve read that and put exactly this in the config.php. Must I then link to that url explicit or should the article-links get that type of url automaticly? Either way, if I enter the url directly I get an error page and otherwise there are no changes to the urls, in the panel for instance.
Maybe I’ve changed some things in the last days testing Kirby… I could do a fresh install…
Okay, with your edited example it works. I can call the new url! I have a little fear about double-content then, cause I can adress an article with to urls?
Kirby doesn’t create those links automatically. But you can use a page model that does this for you, for example:
<?php
class ArticlePage extends Page {
public function url() {
return url('blog/'. $this->date('Y/m').'/'.$this->uid());
}
}
With this model, you overwrite the native url()method for all article pages, i.e. all pages that use the article.php template and thus the article.php model.
Well, with the above model in place, that shouldn’t be an issue, because the original URL wouldn’t be known to search engines because it isn’t used anywhere. But I’m no SEO expert, whatever that is.