2 Comments

WordPress Tips 2

Wordpress Tips 2Continuing from yesterdays tips I have a few tips that can help bloggers begin.

Purty Colors

Syntax Highlighting in Blogposts with Vim

Post Ownership

Being blog-rolled is when a post the owner has written appears to belong to someone else because it has been reprinted. I use the creative commons attribution license here so my content is free distributable as long as there is reference to the original work but I have discovered that search engines can misinterpret the original owner of the post. Google has a fail-safe that can tell ownership of a post by that post linking to itself. I have created a script that can makes this simple:

#!/bin/bash

# vm2html-segment
#
# Create HTML formatted text suitable for displaying syntax highlighting
# in a blog post, or possibly some forums.

FILENAME=$1

#vim -f +"syn on" +"let html_no_pre = 1" +'let html_use_encoding = "utf8"' +"let use_xhtml = 1" +"let html_number_lines = 0" +"so \$VIMRUNTIME/syntax/2html.vim" +"wq" +"q" $FILENAME

vim -f  +"syntax on" \
        +"colorscheme simple256" \
        +"let html_no_pre = 1" \
        +"let html_number_lines = 0" \
        +"TOhtml" \
        +"x" \
        +"q" $FILENAME


# Just need the colored syntax, deleting the HTML page information.
sed -i '1,/body bgcolor=/d' $FILENAME.html

# Adding preformatting first <pre> tag
sed -i '1 i <pre>' $FILENAME.html

# Line breaks no longer need to be defined with preformatted text.
sed -i 's|<br>||g' $FILENAME.html

# Remove the closing HTML tags.
sed -i 's~</body[^>]*>~~g' $FILENAME.html
sed -i 's~</html[^>]*>~~g' $FILENAME.html

# Add the closing preformatting tag
sed -i '$ a </pre>' $FILENAME.html


Type “wordpress-link title of post” and paste in blog. This creates an invisible link and will not be seen.

Style Sheet

Commercial wordpress users will need to pay a few dollars to be able to create a custom style sheet. Some style sheet attributes can be added though within the html tags. For instance, I like padding around images:

<img src="http://linuxtidbits.files.wordpress.com/2008/03/link-saturday.png" style="margin:0 10px 5px 0;" align="left" alt="Links Saturday" /     >

WordPress RSS Feeds

A final note on WordPress RSS feeds. WordPress RSS feeds do the odd behavior of subsituting the username for the title of the feed. Changing to an ATOM feed can fix this but if you’re stuck with a news aggregator site that refuses feed changes the title can be changed by defining the name (alt tag) of the last image of the post:

<img src="http://linuxtidbits.files.wordpress.com/2008/04/wordpress-icon-128.jpg" style="border-width:0;" align="left" alt="Wordpress Tips 2" />

Hope this makes blogging better! :)

About these ads

About Gen2ly

<3's linux

2 comments on “WordPress Tips 2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 51 other followers

%d bloggers like this: