Page 1 of 1

finding HTML <title> elements within an EPUB file

Posted: Wed Nov 21, 2018 1:45 pm
by Heidi
Good afternoon, everyone. I hope you are having a great and productive week so far.
This topic is for you if you are having any difficulty answering the following question in the EPUB testing criteria Excel document: Does each HTML document within the EPUB book contain a meaningful <title> element?
Before we begin, you may be asking, "Just what is a <title> element anyway?" In HTML files, the <title> tag contains the text you hear when you read the title bar within your browser. When reading an EPUB book, especially on Windows, text within the <title> tag is usually the first line you will read
at the very top of a document. As you know, an EPUB file is compressed, containing separate XHTML files for each chapter and major section you read. When you open a chapter in your reader, the software is accessing the relevant XHTML file for you behind the scenes and then displaying it. In most Windows-based readers, the first line you read at the top of a new chapter or section is actually the text contained within the XHTML file's <title> tag. The text you hear should be meaningful, telling you what chapter or major section you are currently reading. At the very least, you should hear the title of your book. It should not contain information such as the XHTML document's filename because the filename may not actually describe what the file is about.
If you are interested in reviewing a book's underlying HTML code to read the text of a <title> tag for a chapter of interest, unzip the EPUB document. This may be done in a variety of ways. You could use an app such as Codex or any other converter to translate the book into an HTML archive. Or, you can simply change the file's extension from EPUB to ZIP. If you use this method, just press enter on the renamed file and voila, you are presented with a ZIP archive of all of the book's contents. HTML files are usually located within the OEBPS directory. Navigate to a chapter of your choice. You will now be able to open all XHTML files within your browser. In most browsers, pressing Control+U will allow you to read an HTML file's underlying source code. An HTML document is composed of two main sections, the head and body. Header information, contained within the <head> tag is where you will find the <title> element. The text sandwiched between the <title> and </title> tags is the first line that you read at the very top of a chapter or major book section within your EPUB reader. Here is a hypothetical example of what you may see when reading the <title> tag: <title> Chapter 5: My Walk to Freedom </title> This is an example of a descriptive title that clearly communicates what you are about to read. In contrast, <title> A_Stone_For_Andrew_Dunphy5-6 </title> really doesn't tell you much of anything.
I hope this explanation helps you in your work. If you have any questions, please let me know.

All the best,