michal-h21 / make4ht

Build system for tex4ht
137 stars 15 forks source link

Question on customized template #82

Closed huijunchen9260 closed 2 years ago

huijunchen9260 commented 2 years ago

Dear Michal:

Is it possible to let make4ht to insert some chunk of HTML code to match the theme of my website? Like the custom footer so that the article would also have homepage button something like that.

HJ

michal-h21 commented 2 years ago

Dear HJ,

you can use the \Configure{@BODY} and \Configure{@/BODY} commands to add some stuff at the page beginning and at the end. Try this configuration file:

\Preamble{xhtml}
\Configure{@BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{<div>Some code at the beginning</div>}}
\Configure{@/BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{<div>Some code at the end</div>}}
\begin{document}
\EndPreamble

Info about these configurations is here. The \IgnorePar\ and\EndP` command are necessary for the correct handling of paragraphs, see this section

huijunchen9260 commented 2 years ago

That is pretty helpful! I also want to know whether it is possible to include the external HTML file into the config file. For example,

\Preamble{xhtml}
\Configure{@BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{<div>expenad code from external html file</div>}}
\Configure{@/BODY}{\ifvmode\IgnorePar\fi\EndP\HCode{<div>expand code from external html file</div>}}
\begin{document}
\EndPreamble

So that after using static site generate this html page will also have proper header and footer that I intended.

Thank you!

michal-h21 commented 2 years ago

Unfortunately, inclusion of external HTML is not supported. But if you want to use static site generators, you may be interested in the static site extension. See this blog for example.

huijunchen9260 commented 2 years ago

That's nice, yet I am using blogit, a very minimalist static site generator to display all my files, so I am not sure whether I am incorporate the make4ht to all of my webpage, yet if only serve for the HTML version of the pdf file, I believe make4ht/tex4ht is still an amazing software!

This is my application.