Go to content Go to navigation Go to search

Maikimo.net taxonomy tags

Intertwingularity revealed

Articles filed under tag “movable-type”

Tags: , Crufty URL cleanup complete

2006-08-16: This 2004 info applies to my earlier blog tool, Movable Type, not necessarily the current one, Textpattern.

Early on in my Movable Type weblog design journey, I let Mark and Anders guide me toward greater website accessibility.

But as time goes on some of these suggestions have gotten long in tooth — Mark himself made some sweeping changes toward “cruft-free URLs” nearly a year ago. What I’ve been most aware of in my configuration to date is how lengthy some of my entries’ permalinks were getting.

Goals

I want to shorten my permalink URLs, and while doing so I might as well also incorporate other changes suggested by Mark et al.:

  • Change underscores to hyphens (for more advantageous Googlification)
  • Drop filename extensions (a step toward future-proofing against published file format changes)
  • Eliminate unnecessary daily archive subcategory (monthly’s enough; I don’t post much)
  • Redirect old lengthy permalinks to the spiffy new ones (so incoming Google searchers land on intended page)

Result

before:
http://maikimo.net/mt/archives/2004/06/01/  \    changes_afoot_musings_about_webhosts_blogging_software_freedom.html

after:
http://maikimo.net/mt/archives/2004/06/changes-afoot

How

Shorten filename part of entry permalinks:

Dave’s Short Title Plugin employs square-bracketed keyword(s), if present, as the entry’s short title (or “slug,” the term Mark uses). Non-bracketed keywords continue to function as keywords, which I need for generating related entries.

Install the plugin, then in MT’s Templates > Archiving screen for the weblog under consideration, change the Individual Entry Archive’s Archive File Template format

from
<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryTitle dirify="1"$>.html

to
<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryShortTitle dirify="1"$>.html

Change underscores to hyphens:

Use Crys’ DirifyPlus plugin instead of the built-in dirify:

which changes previous result to
<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryShortTitle dirifyplus="pld"$>.html

(where p = elim all slashes, l = convert to lowercase, d = convert spaces to dashes)

Drop filename extension:

which leads to
<$MTArchiveDate format="%Y/%m/%d"$>/<$MTEntryShortTitle dirifyplus="pld"$>

Eliminate unnecessary daily archive subcategory:

which leads finally to
<$MTArchiveDate format="%Y/%m"$>/<$MTEntryShortTitle dirifyplus="pld"$>

as the Individual Entry Archive’s Archive File Template format.

Redirect old lengthy permalinks to spiffy new ones:

Use Nathan’s idea to let MT generate the archives/.htaccess that rewrites old URL formats to new. Here’s the .htaccess implementation I came up with (click the Download link). I’m using this as content of a new index template that outputs archives/.htaccess.

I found parsing extension-free files for PHP directives (which I need) requires
ForceType application/x-httpd-php

so I put that in there, but it then needs to be overridden with a
ForceType none

in archives/images/.htaccess and archives/photos/.htaccess to allow graphics to display.

Precedents

I had observed the following:

Mark’s URLs generated by WordPress now look like
http://diveintomark.org/archives/2004/06/18/favorite-jokes

Shelley’s URLs generated by WP look like
http://weblog.burningbird.net/archives/2004/06/21/what-was-interesting/

Default WP permalinks look like
http://maikimo.net/wp/archives/2004/05/16/hello-world/

Default Textpattern clean permalinks look like
http://maikimo.net/txp/article/1/first-post

Tags: , , , , , , , Changes afoot (musings about webhosts, blogging software, freedom)

[St. Columba: Pavilion picnic table graffiti]TextDrive. Last week from a lonely hotel room in beautiful Pleasanton, California — I was in the Bay Area for Documentum training — I (without much planning) jumped on a stellar webhosting offer from Dean Allen, maker of Textpattern, and thus became one of the lucky VC200, first “venture capitalists” of many customers to come in Dean’s (and business partner Jason’s) new webhost service TextDrive.

As the Textpattern CMS is TextDrive’s emphasis (but not requirement of course) perhaps I should devote more time to mastering it.

Textpattern. I’ve been admiring Textpattern for quite some time as an alternative web publishing system to Movable Type, which I’ve been using happily for the last year and a half.

Why an alternative? Not because I’m all a-dither about the Movable Type 3.0 pricing brouhaha — I like MT, understand it reasonably well, and appreciate its Perlishness relative to PHP. And I trust Ben, Mena, Anil, et al. to get the pricing/licensing kinks worked out.

Freedom. I’m interested in an alternative because I’ve been a Free Software enthusiast and advocate since my immersion into Linux in early 1998, and I want to use truly free weblogging software. (Shelley and Mark provide informative takes on freedom, blogging, and software licensing.)

WordPress. WordPress is another truly free contender (GPL license) and perhaps has the most post-MT mo’ right now. Shelley’s extensive writing about it at Burningbird (just search her blog for “wordpress”) persuaded me to look closely at WordPress, and it is indeed wonderful.

But Dean’s style just radiates from Textpattern (BSD license GPL license as of g1.19) in a way that intrigues me and captures my imagination. And my <ahem> skim-only, read-only “participation” in the Textpattern community over the past several months tells me these are people I’ll enjoy knowing better.

Objects. Textpattern employs software engineering concepts that rang familiar as I studied Documentum last week. For example, instead of uploaded graphics files being scattered in the filesystem of a served directory where they’re hard to track, each graphic file uploaded to Textpattern becomes an object with category, alt text, and caption metadata accompanying it. The uploaded graphic filename itself is of no consequence — it’s actually saved with a numeric filename — because Textpattern keeps the physical file associated with its image metadata. This easy-to-grasp object approach (where behind the scenes the object == filesystem file + database metadata) is generally how Documentum does things.

Object-oriented thinking in this context is still somewhat new to me, so I may be making too much of this. But I was struck by — and impressed by — the conceptual resemblance between Textpattern and Documentum on this.

Sizzle. Even though I advocate Free Software, I nevertheless use Mac OS X on my PowerBook most of the time instead of the completely free Gentoo- or Debian Linux distributions, each of which is as extraordinary on PowerPC hardware as it is on ix86 PC hardware. My use of Mac OS X is a conscious decision to forego a bit of freedom in exchange for enjoying The Most Empowering OS I’ve Ever Experienced. But even within the half-free, half-not-free world of Mac OS X, I use much Free Software, thanks primarily to the Fink project.

Here I am two and a half years into blogging, and I’ve cycled back ‘round to thinking I don’t have much to say. The unholy alliance between church and state in the U.S. is now unraveling on its own, thank God. The malign incompetence of our Executive Branch is becoming common knowledge. In my railing against these in this blog I’m hardly the lone voice I felt like last year; I’m now one among many. And of these many political- and faith-obsessed oriented bloggers, most write far more effectively than I do. So maybe now is a good time for me to be quiet and learn free blogging software.

I hope to return to writing about odds and ends I find interesting, useful, beautiful, lifegiving, instead of being constantly consumed by political/religious anger and despair. After all, blogs that showcase the multifaceted interests of people I’m delighted to meet are the blogs I most like to read.

Tags: , , , Blogging, backbone, buds: two years running

I’m pleased to report the dubious achievement of now having more than two years of weblog entries here, all reachable via the Search field.

Two years doing any one thing represents follow-through for me on par with completing a marathon. Wow.

Best outcomes of blogging so far?

  • I’m finding my voice and the courage to use it. The idea that one day voice, message, and skill might be called forth in unison to serve good ends motivates me.
  • I’ve made new friends. Not having had to be alone during the last three years is a priceless gift. Life in an insane asylum (the world of U.S. conservative religiopolitics) is no stroll in paradise, however beautiful the inmates and surroundings. I get too serious about it and then forget to laugh. (Wouldn’t it be great to be remembered as someone who laughed a lot?) I’ve learned that friends help friends laugh.

David at Orcinus, a blogger I learn a lot from, wrote yesterday about The spurious rise of the non-anonymous blogger. All this interesting discussion for and against blogging anonymity postdates my “choice” of non-anonymity — my ass is hangin’ out there because two years ago it never occurred to me I could whip up a pseudonym.

Just as well: writing-as-myself exercises my internal editor so I’m a little fairer, more thoughtful, and more compassionate than I might be otherwise.

Hmmm. Maybe non-anonymous writing can also work for people like nutrition information does for foods: it gives clues whether you’d like the item and what it’s made of. I like knowing people through their writing — and letting them know me, which leads to more friends than I could actually meet in person — and then thinking that should we meet in person we’d soon feel right at home with each other based on this agreeable written history instead of having to waste time assessing whether one or the other of us is a jackass. :-)

My 2003 and ongoing 2004 weblog entries are all nicely tied together here in Movable Type with links every which way: entry to entry, month to month, day to day, category to category. (Try clicking an entry’s month name, for example.)

My 2002 entries were almost all published using a different system, Radio UserLand, and are accessible as published starting here.

But I’ve also imported these 2002 entries into Movable Type (using Bill Kearney’s Radio Exporter.root tool) so that all weblog content is searchable from within Movable Type. FWIW, the imported 2002 content starts here.

2006-08-16: This 2004 info applies to my earlier blog tools, Movable Type and Radio Userland. I’m now using Textpattern.

Tags: , An easy photolog made easier

2006-08-16: This 2003 info applies to my earlier blog tool, Movable Type, not the current one, Textpattern.

[Granny's dinner bell]I set up my Movable Type photolog a long while ago following Jeremy’s fine instructions. But as a practical matter I haven’t added to it often because manually calculating heights, widths, and paths is more than I really want to do.

I dimly realized back in December that Brad’s MTEmbedImage plugin could do the calculations and thumbnail creation automatically using ImageMagick, but I’m only just now getting MTEmbedImage woven into Jeremy’s approach. (I could be using newer, presumably more comprehensive approaches like Brandon’s MTPhotoGallery, but I like the simplicity Jeremy’s provides, and I wanted closure on understanding how to use MTEmbedImage.)

I present this as one example of how to put MTEmbedImage to use.

Example: With these template adjustments to Jeremy’s instructions, all I have to do to publish an image is (1) copy it into my appropriate archive directory, (2) create a new photolog entry containing just title, image filename, and optional description, and (3) save. Like so:

Title: Dinner bell, no chihuahua
Entry Body: IMG_1252.jpg
Extended Entry: This is the dinner bell that stood on a pole at my grandparents’ house. It’s part of my earliest memories. Ring, ring, ring, come to dinner! (which in the country means the noontime meal).

You can see this entry’s published result on photolog’s main page (thumbnail is autogenerated) and on photo’s individual archive page.

The result looks exactly the same as before, but now it’s more nearly effortless to achieve.

Key additions to photolog templates:

mtphoto-main-index.tmpl —

<!-- MWJ 20031108: use of MTTagInvoke allows forcing no convert_breaks in -->
<!-- MTEntryBody, which if present breaks MTEmbedImage output; not possible -->
<!-- with standard MTEmbedImage "[MTEntryBody]" syntax -->
<a name="<$MTEntryID pad="1"$>"> href="<$MTEntryLink$>"> <MTTagInvoke tag_name="MTEmbedImage" width="96" thumbsuffix="_tn-96w">
<MTTagAttribute name="basename">archives/images/<MTEntryBody convert_breaks="0"></MTTagAttribute> <MTTagContent>
<img src="<$MTBlogURL$><MTEmbedImageThumbFilename>" width="<MTEmbedImageThumbWidth>" height="<MTEmbedImageThumbHeight>" alt="<MTEmbedImageThumbFilename> (<MTEmbedImageThumbSize measure="k">k)" border="0" />
</MTTagContent>
</MTTagInvoke>
</a>

mtphoto-archive-indiv.tmpl (also mtphoto-archive-cat.tmpl and mtphoto-archive-date.tmpl) —

<!-- MWJ 20031108: use of MTTagInvoke allows forcing no convert_breaks in -->
<!-- MTEntryBody, which if present breaks MTEmbedImage output; not possible -->
<!-- with standard MTEmbedImage "[MTEntryBody]" syntax --> <p>
<MTTagInvoke tag_name="MTEmbedImage">
<MTTagAttribute name="basename">archives/images/<MTEntryBody convert_breaks="0"></MTTagAttribute> <MTTagContent>
<img src="<$MTBlogURL$><MTEmbedImageFilename>" width="<MTEmbedImageWidth>" height="<MTEmbedImageHeight>" alt="<MTEmbedImageFilename> (<MTEmbedImageSize measure="k">k)" border="0" />
</MTTagContent>
</MTTagInvoke>
</p>

Because the thumbnail URL is no longer being stored in the database as part of the entry, I can’t use SQL as I’ve been doing to select random photolog thumbnails for display on my main blog’s main page. I have to recalc the thumb URL as on photolog main page:

sb-photoselect.inc —

<!-- MWJ 20031108: Switching from SQL to alternative photolog --> <!-- retrieval that recalc's thumbnail URL (its URL no longer --> <!-- present in database) -->

<MTOtherBlog blog_id="2"> <MTRandomEntries lastn="10">

<div class="preview">
<a name="<$MTEntryID pad="1"$>" href="<$MTEntryLink$>" title="<$MTEntryTitle$>">
<MTTagInvoke tag_name="MTEmbedImage" thumbsuffix="_tn-96w">
<MTTagAttribute name="basename">archives/images/<MTEntryBody convert_breaks="0"></MTTagAttribute>
<MTTagContent><img src="<$MTBlogURL$><MTEmbedImageThumbFilename>" width="<MTEmbedImageThumbWidth>" height="<MTEmbedImageThumbHeight>" alt="<MTEmbedImageThumbFilename> (<MTEmbedImageThumbSize measure="k">k)" border="0" />
</MTTagContent>
</MTTagInvoke>
</a>
</div>

</MTRandomEntries> </MTOtherBlog>

Result is the random several thumbnails displayed in my main blog’s main page right sidebar.

As I tweak further, my current live photolog templates stay accessible here. (Yes, these hacked-up photolog templates, while functional and valid XHTML 1.0 Transitional, need a good sweeping and deuglification. Soon come.)

Additional Movable Type plugins used <applause, applause>:

Related: For easy bulk publishing of images, I’m fond of David Ljung Madison’s command line HTML photo album generator, album (which has nothing to do with Movable Type).

<!— imported into Txp from MT on 2004-12-23 (as orig published on 2003-11-12) —>
<!— May not be relevant in new context —>

Tags: , , Valid XHTML multi-paragraph blockquotes in MT

Last fall when Jeff Szymona posted four MTMacro macros to correct MT’s p tag wrappage around blank line-delimited blockquote tags — which breaks XHTML 1.0 validation — I immediately started using them and they solved my validation problem.

But now as I implement backshaded multi-paragraph blockquotes, I find I need a little more filtering.

I’ve been wrapping each paragraph of a multi-paragraph blockquote with its own blockquote tags. But this makes CSS styling of the blockquote as a contiguous block difficult. And adding the extra blockquote tags has been a hassle.

Here’s what’s correct according to the W3C:

<blockquote cite="http://www.example.com/tolkien/twotowers.html">
<p>They went in single file, running like hounds on a strong scent, and an eager light was in their eyes. Nearly due west the broad swath of the marching Orcs tramped its ugly slot; the sweet grass of Rohan had been bruised and blackened as they passed.</p>
</blockquote>

That is, the blockquote element needs to contain one or more block-level elements, not bare text (the cite attribute is optional).

Here’s what I want to enter (with a quick copy and paste):

<blockquote>The rain in Spain falls mainly in the plain. The rain in Spain falls mainly in the plain.

The rain in Spain falls mainly in the plain. The rain in Spain falls mainly in the plain.</blockquote>

Here’s how I want MT to render it:

<blockquote><p>The rain in Spain falls mainly in the plain. The rain in Spain falls mainly in the plain.</p>

<p>The rain in Spain falls mainly in the plain. The rain in Spain falls mainly in the plain.</p></blockquote>

I created three additional macros to supplement Jeff’s, and AFAICT they’re meeting this goal. All seven macros in a clean text snippet here.

Jeff’s original macros:

<MTMacroDefine name="pdiv1" pattern="m/<p\x3e<div/"><div</MTMacroDefine>

<MTMacroDefine name="pdiv2" pattern="m/<\/div\x3e<\/p/"></div</MTMacroDefine>

<MTMacroDefine name="pbq1" pattern="m/<p\x3e<blockquote/"><blockquote</MTMacroDefine>

<MTMacroDefine name="pbq2" pattern="m/<\/blockquote\x3e<\/p/"></blockquote</MTMacroDefine>

My three additional ones:

<MTMacroDefine name="pbq3" pattern="m/<blockquote\x3e(?!(<p\x3e|\r))/"><blockquote><p></MTMacroDefine>

<MTMacroDefine name="pbq4" pattern="m/(?<!<\/p\x3e)<\/blockquote\x3e/"></p></blockquote></MTMacroDefine>

<MTMacroDefine name="pbq5" pattern="m/(?<!\x3e)\s*\n\n\n*<p\x3e/"></p><p></MTMacroDefine>

Alas, I’m no Friedl; I think it’s the negative lookbehind assertion in my pbq4 macro that slurps clock cycles. If you see a more efficient solution, please comment.

I see I really need to start using the blockquote element’s cite attribute. Brad even provides code to automatically make the citation a visible link in the blockquote.


Here’s what the new macros are doing:

pbq3: from `perldoc perlre` —

/foo(?!bar)/   ("foo" not followed by "bar")

I want "<blockquote>" not followed by "<p>" or "\r".

find                                replace
/<blockquote>(?!(<p>|\r))/          <blockquote><p>     straight Perl regex
/<blockquote\x3e(?!(<p\x3e|\r))/    <blockquote><p>     encoded for MTMacro use

<MTMacroDefine name="pbq3" pattern="m/<blockquote\x3e(?!(<p\x3e|\r))/"><blockquote><p></MTMacroDefine>

pbq4: from `perldoc perlre` —

/(?<!bar)foo/   ("foo" that does not follow "bar")

I want "</blockquote> that does not follow "</p>".

find                              replace
/(?<!</p>)</blockquote>/          </p></blockquote>   straight Perl regex
/(?<!<\/p\x3e)<\/blockquote\x3e/  </p></blockquote>   encoded for MTMacro use

<MTMacroDefine name="pbq4" pattern="m/(?<!<\/p\x3e)<\/blockquote\x3e/"></p></blockquote></MTMacroDefine>

pbq5: from `perldoc perlre` —

/(?<!bar)foo/   ("foo" that does not follow "bar")

I want "\n\n\n*" that does not follow ">" (to insert line-end </p> instances that MT seems to have missed).

find                              replace
(?<!>)\n\n\n*<p>                  </p>\n\n<p>   straight Perl regex     
(?<!\x3e)\n\n\n*<p\x3e            </p>\n\n<p>   encoded for MTMacro use

<MTMacroDefine name="pbq5" pattern="m/(?<!\x3e)\s*\n\n\n*<p\x3e/"></p><p></MTMacroDefine>

I’m not sure how to enter returns in an MTMacro pattern macro replace. (Neither "\n\n" nor "\\n\\n" works.) The emitted HTML would be more cosmetically pleasing if two returns were present between the previous line’s </p> and <p>.