Crosspost To LiveJournal [V.0.4]

By Serdar Yegulalp on 2008-11-16 16:53:48 No comments

Note: You can now access this page through a TinyURL shortcut:

This is a simple index template I whipped up to allow people to crosspost their most recent Movable Type entries to a LiveJournal account.

Revision History


  • Website-specific variable controls.


  • Results are posted to auto-revealing IFRAME.
  • Now shows list of all posts on main page.
  • Floating, collapsible post-navigation list.
  • Navlist auto-collapses after nav action.
  • Jump-to-top shortcut at each post.


  • Extended entry text is automatically placed behind an lj-cut tag.
  • Text input areas resized.
  • Link back to original post.
  • Option to post summary + entry only.
  • Some other formatting changes.

0.1: First version. Verrry primitive!


This script is released under the terms of the MIT Public License.


1. Create a new index template with the template type as "Custom Index Template", the file extension as .php, and the publishing option as "Static". The exact naming and location is entirely up to you, so long as you can access it without too much hassle. Note that if your publishing options vary you can change either of these to suit, but these are the defaults that work for me. I prefer to publish it as index.php in a directory all its own.

2. Add the following text to the template, and save and publish it:

Crosspost to LJ version 0.4 code (UTF-8 text)

3. Edit the variables in the section labeled "Set variables here for your website/LJ". This contains your LiveJournal username and password (as LJUSR and LJPWD), the password you'll use to access this page (under PWD), a graphic icon you can use at the top of the page (ICON), and the link to your LiveJournal account (LJ)

If you want to change the options to leave comments, set the prop_opt_nocomments value to 0.

In my personal version of the script, I have it off by default and just append a link to the bottom of every post that links back to the original post:

<p>[<a href="<mt:EntryPermalink>">Comment here</a>]</p>

4. Save and publish the results.


Bookmark the index template and add the parameter ?pwd=<your password set as PWD above>.

Whenever you publish a new entry, go to that page and you'll see text boxes that contain the subject, body of the post, and the tag list. I've left the fields open for editing, but for the most part you don't need to change anything. Click "Post to LJ" and you should see a confirmation message from the LJ servers, along with the URL of your new post.

You'll also see text boxes for each of the posts you've made that are now showing up on the front page. This is useful if you want to post older stuff to LJ (for instance, after an outage).

The "Post list" that floats at top right contains a quick list of all the posts available on this page. Click "Show" to browse the list and "Hide" to close it up. Note that when you click any entry on the list, the list automatically hides after one second.

To Do

Better security handling. Hard-coding the password in the template and sending it in plaintext is not secure, period. I plan to do something about this in the future, but right now there are a few things you can do on your own to ameliorate these issues. You can, for instance, hard-code only the username and poll the user for the password by unhiding the password field. I'll probably make this into an option at some point.

As of 0.4, I now prompt for some kind of password as a pwd= parameter in the URL. Again, scarcely industrial-strength, but it'll keep out most casual discovery. (I'm looking into a way to make this play nice with MT's own native login system, actually, but that's a long way off.)

More options. The template only has the most minimal option set. It doesn't let you change the mood or anything else, which are things I want to see if I can pick up from the original post depending on how users have things set up.

The possibility of crossposting to other systems. I'm using Facebook and Twitter a bit more, for instance, so I'm looking at turning this into a general framework for crossposting to multiple services without needing a plugin. That will come much later, though.

Tags: LiveJournal Movable Type programming

About This Page

This page contains a single post by Serdar Yegulalp, in the category Uncategorized / General, published on 2008-11-16 16:53:48.

See all entries for November 2008.

See all entries in 2008.

Find recent content on the main index or look in the archives to find all content.

About Me

I'm an independent SF and fantasy author, technology journalist, and freelance contemplator for how SF can be more than just a way to blow stuff up.

My Goodreads author profile.

Learn some more about me.

My Books

Now Available

Previously Released

More about my books

Search This Site