system PAUSE system PAUSE - 6 months ago 27
HTML Question

What extension should I use for files containing fragments of HTML?

The ".html" suffix on a filename implies that the document contains

html
,
head
, and
body
tags.

I have some files that each contains a
div
element or two, but no
html
or
body
tags. The file contents are well-formed HTML fragments in the sense that they could be inserted into a
body
tag of a compliant HTML document, and it would still be compliant. (They contain no "
<% %>
" markers, no PHP code, etc.) But a fragment file is not compliant HTML by itself, so I'd like to give it a different naming convention.

Several "file extension" sites include an entry for ".PHT" and describe it as "Partial Hypertext File." That sounds promising, but I can't find any additional explanation on the origin, expected file format, or applications that use it. Also, many of the same sites identify ".phtml" and ".phtm" (which appear to be longer versions of the .pht suffix) as PHP files — as noted, my files are not PHP files.

Should I use ".pht" as a suffix? Is there a more appropriate naming convention?

Edit:
I'd like to distinguish fragment files from the full HTML documents in the same directory.

Answer

I would use .inc (meaning include file) or .txt.