Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Including entire book to contents of site?

How would a developer go about adding ALOT of text content to a site. For example adding the contents of a book (100s of pages) <p> tags seem to have a limit on the amount of content they will hold and breaking content up into multiple <p> tags just seems like a bad idea, im sure there is a solution right in front of me but im stuck on ideas. Any help would be appreciated.

1 Answer

See if the book authoring program has an export to HTML option. For instance, in Word, if you "Save As" HTML you get something similar to the fragment below (along with a lot of other xml junk above the html). From here you could strip out the Microsoft classes and formatting "MsoNormal" etc. with a quick find and replace in your favorite code editor.

<body lang=EN-US style='tab-interval:.5in'>
<div class=WordSection1>
<p class=MsoNormal>This is a paragraph</p>
<p class=MsoNormal>This is another paragraph</p>
</div>
</body>

If you have 100's of pages you still need to have a plan for either splitting the content (chapters maybe?) or incrementally loading the content. Maybe take a look at some of the longer works on fanfiction.net for an example. There really isn't a limit on the length of a <p> tag, but if your page takes too long to load and render, the browser (or user) may think that something has gone wrong.