Today, I had a small bit of panic going on: apparently my migrated content somehow interferes with Drupal Extended Path Aliases. In the Movable Type era, this blog used to reside under /users/wwwwolf/blog/2013/10/whatever.html, and apparently Extended Path Aliases gets confused by that sort of links because they have /users/wwwwolf in them. Now, I removed the module and redirects work again.

But - aaah! - this means that my feed URLs no longer work.

A bit of background: I don't use Drupal's built-in Blog module here. The reason being that I need multiple blogs, all by same author. Blog module makes it easier to do one blog by one author, or multiple blogs by multiple authors, and nothing in between. In my setup, it's just easier to do this:

  1. Set up a new content type (blog_entry)
  2. Add a new taxonomy "Blogs" and subterms for each blog ("Wolf Head of Self-Repair", "The Gameless Game")
  3. Alias those terms to URLs (blogs/wolfheadofselfrepair, blogs/gamelessgame)
  4. Add a mandatory "Blogs" term reference (blog) to blog_entry
  5. Configure the pathauto URL alias of the term entry to stick the content at [node:field-blog:url:path]/[node:created:custom:Y]/[node:created:custom:m]/[node:title]

The last step is the "clever" part. Essentially, when I post blog entries, all I need to do is to choose the blog. Drupal is then smart enough to think "I need to figure out the URL where the content gets posted at. Well, I know the user chose a blog. I know the blog is located at blogs/foo.  Hence, all I need to do is to use that blog's location and stick that in the beginning of the URL, followed by all that other permalink guff." This is the essence of Drupal: If you can reduce work by putting relevant information in one place, do it!

So,

  • The blog can be viewed at blogs/foo
  • New entries appear as blogs/foo/2013/10/whatever-the-title-was
  • Blog feed appears at blogs/foo/feed

...Ooops! I relied too much on automatics. The last item was provided by Extended Path Aliases. Without that module, the feed will actually appear under taxonomy/term/12345/feed, even if the taxonomy term has an URL alias specified. Fair enough, because stuff shouldn't be too automagical, but this is still not what we want - I'd rather specify the taxonomy term URL alias and the associated feed URL alias together, but Drupal's built-ins don't handle that.

Yup, the default taxonomy view sucks. It just provides relatively inflexible view of content and can't really be customised without effort. So I just knew that eventually I'd have to toss it, and do things in a bit more complicated and hopefully much more flexible manner using Views.

All I need to do is...

Uh... *furious headscratching*

Remember the part where I aliased the terms to URLs? Yeah, the blog entries take the pathauto alias from taxonomy term URLs. In above scenario, taxonomy terms have to have an URL. And in my new scenario, I need to put a view in there, and not actually display the automatic taxonomy term anywhere, really. So we need the taxonomy terms to remember the URL, just not actually use the URL for anything.

So how do we do this?

I actually needed a new module for this - Link. The revised plan is this:

  1. Add a new Link field, "view mountpoint", to the Blog taxonomy.
  2. Put blogs/wolfheadofselfrepair and blogs/thegamelessgame in them.
  3. Remove the URL aliases of the taxonomy entries.
  4. Set the automatic path of new blog entries to [node:field-blog:field-view-mountpoint:url]/[node:created:custom:Y]/[node:created:custom:m]/[node:title]
  5. Create new views that show blog entries and feeds at blogs/foo and blogs/foo/feed

Why did I need Link? I tried adding text fields, but pathauto was a moron and turned that to "blogsfoo". Pathauto has a an annoying habit of not trusting slashes that I enter. Damn. But Pathauto integrates just fine with Link module.

So now, in summary:

  • The blog can be viewed at blogs/foo, which is now provided by a View.
  • New entries appear as blogs/foo/2013/10/whatever-the-title-was and the "blogs/foo" part is fetched from "view mountpoint" field of the taxonomy term
  • The feed at blogs/foo/feed is provided by the same View using a different mode.

So now I have views! And I hope automatic path shit works when I hit submit. =)

Edit: Yup, and it works! Also I posted it on wrong frigging blog, which was easily corrected. Here's one of the reasons why Drupal is nicer than Movable Type: If I get a brainfart and post something on a wrong blog in Movable Type, it's "shit shit shit copypaste copypaste copypaste delete delete delete". Drupal? Hit edit, change taxonomy field, save, edit, blow away useless redirect, your day can continue.