Coding Poems

Though every poem is going to be different, the following should provide enough of a guide to get started with most poems. First we’ll show how to code a basic poem with no crazy white-space or other visual features - just left-aligned lines and some stanza breaks. Then we’ll talk about tips and tricks for the trickier poems.

Basic step-by-step

1. Copy the poem from the PDF or Word doc and paste it into a plain text editor. In this tutorial, we’ll be using Notepad++ (Windows).
2. You’ll often need to re-break the lines once in Notepad++ so the pasted poem matches the original.
3. Highlight the space at the end of the first line through to the beginning of the next line down, and type Ctrl+H.
Step 3 screenshot
4. In the Replace field, type </p>\n<p class="line"> and click Replace All.
Step 4 screenshot
5. This should make the poem look like this:
Step 5 screenshot
6. Notice you’ll have to add one more <p class="line"> to the first line, and you’ll have to delete the last <p class="line"> at the end of the poem.

Also, a quick note on what this code is doing, so far: <p class="line"> is telling each line of the poem to act like a “line” version of paragraph, which is a class we’ve defined in the website’s custom CSS. This paragraph class is designed to force longer lines in poems to wrap with an indentation on smaller devices. The empty <p class="line"></p> throughout the example above are white space placeholders for stanza breaks.

7. Now, you’ll need to add the top and bottom matter to the poem so that author/publisher/UI Library info appears in the post. This code will (pretty much) always look like this:
Top matter:

<p class="line byline"><em> by <a href="http://poetry.lib.uidaho.edu/index.php/poets/#sierra-nelson">Sierra Nelson</a></em></p>&nbsp;

Step 7 screenshot
Bottom matter:

<p class="line bookinfo">from <a target="_blank" href="http://www.poetrynw.org/issue-cover/spring-summer-2010/" rel="noopener noreferrer"><em> Poetry Northwest 05.1 Spring & Summer 2010</em></a><a target="_blank" class="librarylink" href="https://alliance-primo.hosted.exlibrisgroup.com/primo-explore/search?query=any,contains,Sierra%20Nelson&tab=everything&search_scope=everything&vid=UID">Find more by Sierra Nelson at the library</a></p><p class="citation">Copyright © 2010 Sierra Nelson Used with the permission of <a href="http://poetrynw.com/" target="_blank" rel="noopener noreferrer">Poetry Northwest</a>.

Step 7 screenshot
9. The actual title of the poem will be entered into WordPress when we get there. For now, this basic poem is all ready to go!

(Actually, 10. Check for typos again. And again.)

Your coded poem should look something like this:
Step 10 screenshot

Tips and Tricks for More Difficult Poems

Indented lines (white space at the beginning of the line)
Lines with caesuras (white space) in the middle of them
Justified prose poems
Poems that spiral, are shaped like hearts, or are otherwise visually experimental