Jump to content

Wordpress-style URLs (including date)


bfncs
 Share

Recommended Posts

Hi there,

I was just reading through the forum and anticipated, that I'll need something like this sooner or later, so I'm already asking: is there already some easy way to get Wordpress-style URLs (including the date) working for a subbranch of the tree?

This should solve use cases like if i have a tree like this with the corresponding URLs:

blog -> /blog

my-article -> /blog/2012/12/24/my-article

my-older-article -> /blog/2012/12/19/my-older-article

...and so on.

It would also be nice to have options to format the URL with all the standard "Structure tags" the Wordpress has:

  • year
  • monthnum
  • day
  • hour
  • minute
  • second
  • category
  • author
  • post_id
  • postname

I see that this is not too hard to do in your templates with URL segments but I'd prefer to have a handy module for this.

Didn't have any time to really investigate into this already, just want to get some feedback on the idea: do you like/need this, is there already something solving this or a similiar featureset?

Greetings,

Marc

Link to comment
Share on other sites

Thanks a lot for sharing your thoughts on this, it's always great to get some feedback! :)

Joost de Valk recommends that on Wordpress you change the permalink to just the post name, so my answer would be to save yourself some work and don't bother. ^-^

Thanks for the interesting link, but I don't really get the point here. Looking at the post where he argues for it, the only "argument" I see there is this:

Putting the date in the URL has very few benefits, if any. I’m not a fan because it “dates” your older results, possibly getting a lower click through over time.

Sorry, I may be ignorant when it comes to SEO, but I have a strong feeling that apart from choosing your keywords wisely, having your markup structured well, using pretty URLs, avoiding duplicate content and aiming for good links back to your site, there's not much more to say about it. Everything else (and what de Valk says there) is more on the quackish and esoteric side in my opinion. Seeking the black cat in the dark room. Please don't feel offended, if you have other thoughts about this.

Why I'm interested in this is because of these reasons:

  • Make it easier to port Wordpress sites that have grown out of their "just a blog"-state. As thistimj pointed out above, this might motivate some more Wordpress users to tinker with Pw.
  • The URL structure with dates may not be perfect for everything, but if you literally have a blog/news section it offers a really nice way to offer your post archives easily.
    Imagine /blog is the overview of all your posts, /blog/2012/ are all posts of 2012, /blog/2012/12/ are all posts in decembre of that year (adding a canonical tag pointing to /blog for the latter two to not make Google punish you for duplicate content, for sure). This would make sense to me and is just something nice to have.
  • Building a good reference implementation for custom routing.
  • Showing the flexibility of Processwire. I already saw some questions like "how can I get the category in the URL but not in the tree", so custom routing in general seems to be a common need.
    In what I'm imaginating, routing paramters wouldn't be limited to the "Structured tags" that Wordpress offers by default, but should be extended to all the input fields you have for a template, making most kinds of custom routing available with minimized tinkering with code.

I'll try to build a module that brings some of the features mentioned here, hopefully get this done in the holidays (no promises though). I'm not currently looking for it, but I already feel, that there will be some customer, that is going to need this and also, I hope to get some better grasp of the core this way.

Greetings,

Marc

Link to comment
Share on other sites

I don't know how Ryan implemented this kind of thing in his blog profile, but my feeling is that you could easily have the best of both worlds. Have each post with a PW style url and list posts (and excerpts) on 'archive' pages by year/month, category, tag, whatever.

Link to comment
Share on other sites

What if the URL was real, as in this would be the tree in the PW:

 - 2012
  - 12
   - 22
    - my bestest article

You could actually create rather simple module to create your page on any given date (meaning: create any needed parent), and even move the articles between different dates, so you actually have adequate URLs.

I think this kind of plays both sides: you get meaningful URL parts (as in 2012/, 2012/12/, …), you get simple moving from wordpress, and you keep your tree in sync with your URLs.

Edit: this freakin' forum botched my [ code ] spacing, but I hope you get the idea :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...