Help - Search - Members - Calendar
Full Version: linking individual entries - a stupid question
Movable Type Community Forum > Additional Resources > Tips and Tricks
Grundy
I feel like this is a stupid questions - largely because it's so simple, but also because it's taken me a couple years to even wonder about it. biggrin.gif

So, how do you guys link individual entries? This question pops up for me because I recently switched servers. On my original server I had MT powering 4 different blogs. This means that EntryIDs were not sequential within any given blog. Anyways, while I was using MT on my original server, I would often link to individual entries from new entries. I never gave much thought to it though, and so I'd just use the URL of old entries from my browser's address bar. This worked fine, except that when I switched servers, I exported & imported entries, recreating them in a new order and completely changing their Entry IDs and URLs. So now I've got a whoooole bunch of dead links.

I'm bringing this up because I've got to switch servers yet again, and I've got my entries exported in a big ol' text file. If there's a way around this, I'd like to fix it before I recreate each and every entry in MT.

So what's everyone else using? And what's the difference between MTEntryLink and MTEntryPermaLink? Should I be using the EntryID tag more effectively?
nammer
I'll be interested to see people's responses - when I link from entry to entry I use the generated link taken out of the browser bar, so you and I are in the same boat smile.gif You might consider looking at something like Cruft-free URLs in MovableType; theoretically, by structuring your Archive Template (which generates your URLs) in a certain way, you can avoid the transitory problems like changing entry IDs. A similar, old-school way of making links independent from entry IDs is by dirifying them, or giving them friendlier names, often based on the title. Check out DirifyPlus for that.

But what do you do when you change your archiving system and break all your links, on purpose? Well, if you're on an Apache server, you can use .htaccess redirects to tell the visiting browser "that file you want? It's over here now." This thread shows you how to do that.

My understanding is that EntryLink is the older tag, and EntryPermalink is the newer one; they do very similar things. From the manual
CODE
MTEntryPermalink
An absolute URL pointing to the archive page containing this entry, with an anchor (#) pointing to the actual entry (by ID). This is the same as <$MTEntryLink$>, but smarter, in that it includes the anchor in all cases except individual archives, where the anchor is redundant.
MTEntryID is just a third way of saying permalink
QUOTE
MTEntryID
The numeric ID of this entry. This is useful for creating anchors for permalinks, and when linking to permalinks. By default the entry ID is not padded; in other words, for an entry with ID 8, this tag will produce only the value 8. Sometimes you would rather have your IDs padded; in that case, you can use the pad attribute to the MTEntryID tag:

<$MTEntryID pad="1"$>

This will zero-pad the entry ID to six (6) digits, like 000008.


Does that help?

Donna
Grundy
Dude, that totally helps! smile.gif

I've been poking through the manual 'til I was crosseyed, but couldn't find an apprecialble difference between EntryLink and EntryPermaLink. And you're right - PermaLink and EntryID do seem to behave the same. I have to wonder though, why you'd ever want to pad the ID#. huh.gif

I've never seen this dirify stuff before though! Cruftfree looks a bit intense for me - my blog structure is never going to be very complicated and my archives are never going to be extensive. But the combination of DirifyPlus and metatags could solve the "how do I link" problem and free me to up to swap extensions w/ out 404s.

Man am I glad I asked. I was mostly just curious - didn't figure there was anything I could actually do to change this. Much thanks! biggrin.gif
kadyellebee
Here's a bit of tag trivia, although I'm counting on my not-so-great memory to tell you this stuff. wink.gif

MTEntryLink is the original tag. It didn't have an anchor on it when linking, and so using
CODE
<$MTEntryLink$>#<$MTEntryID pad="1"$>
was necessary when you were wanting to point to an archive page with more than one archive on it. But if you ever changed your default archive type to individual, the EntryID may not have been necessary, so it was extra code that didn't really need to be there.
So MTEntryPermalink was born, a smarter tag than MTEntryLink. biggrin.gif

MTEntryID is very useful in a variety of situations; basically anytime you need a unique number for an entry. One such use is the Show/Hide javascript that makes a single entry's extended text or comments at a time appear. Its also the basis of default filenames -
CODE
<$MTEntryID pad="1"$>.html

so if you were to want to change directories to have dates or categories in them, you could still use the entry id as the base of the filenaming system.

One reason you'd want the files to be padded is for neater directories.
When the numbers aren't padded, the order would be something like this:
QUOTE
1.html
10.html
100.html
2.html
80.html

But when padded:
QUOTE
000001.html
000002.html
000010.html
000080.html
000100.html

Its just easier in most cases to deal with when the numbers are in the lined up format. smile.gif

To answer yours and Donna's question, there probably are better ways to deal with linking to other posts, but I tend to do the same thing: copy the URL out of the browser window and paste it into my post. If process tags was turned on, you could probably use MTLink to reference the posts by the Entry ID, but that could make rebuilds take considerably longer, I would think.

Anyhow, that's probably more than you wanted to know. tongue.gif

Kristine
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.