Embedding a Bibtex publication list in a website with PHP

Now that I have a more professional website, I wanted to include on it a list of publications. It took me a while to figure out a "good" way to do this, and many things I tried didn't work, so here's the solution I eventually settled on.

Maybe it can help you too!

My list of publications, though not huge yet, is stored in Bibtex format. I wanted a way to embed that nicely on a website.  Since the same bibtex files feed other documents, I didn't really want to retype them in HTML markup. Instead I wanted something which would take the data directly out of the Bibtex files and put it in a format where I could use CSS to style it myself.

Some options I found after searching for a while:

  • Bibbase.org would probably actually be fine. It takes a Bibtex file hosted anywhere, and transforms it into a fancy, viewer-sortable, CSS-stylable list. It allows this list to be embedded via PHP, Javascript or frame into another webpage. The only reason I didn't take this, is that I couldn't find a way to control how it looked (except CSS), and the list seems to be built using Ajax, which is really unnecessary imo. I think overuse of Ajax is a scourge on the web :) That said, it is super easy to use and probably the best solution for most people.
  • There are a number of static Bibtex-to-html tools, such as bibtex2html, and tex2_rst_html, the latter of which actually looked pretty good, but in trying to install it it led me down a pip-chain of dependencies which ended in a 404, so I had to give up.
  • There are some Latex bibliography styles which render Bibtex bibliographies as HTML. I couldn't get any of them to work especially easily and most require editing XSLT or Bibtex style files to change how they look. Besides, while a static Bibtex-to-XML/HTML converter would have been OK, I'd much prefer a live PHP-driven converter.
  • PhpBibLib looked perfect, but I just couldn't get it to do what I wanted, and I don't know PHP well enough to do proper debugging.

Eventually I found:

For the PHP-semi-literate (such as myself), you use it like this:

  1. Upload the files somewhere visible from the PHP page in which you want your publication list.
  2. At the top of your PHP page, add

    Where the paths indicate where you uploaded the files.
  3. ParseEntries() will take a .bib file and convert it into a PHP array. It is invoked like this:

    Where the meaning of the various parameters can be found in the documentation.
  4. Then, $entries is a PHP array of bib entries which can be listed in the following way:

  5. ParseCreators() also allows the conversion of the and-delimited list of authors in a Bibtex entry into a PHP array of author names:
  6. Since the markup is user-written, the style of the publication can be chosen at will, and can be formatted using CSS.
  7. ParseEntries() looks like it will do a bunch of Bibtex-supported things like macros and strings (which I don't use), and also has the benefit that it can parse arbitrary "unsupported" fields. So I used a pdf = {path/to/file.pdf} field in my bibliography to include a link to a file, and a doi = {doi} field to automatically produce a link to the publication's DOI.

Because it's live-rendered in PHP, it would be straightforward enough to have it automatically render me a CV if I wanted.  Problem solved.

I'm currently using it to generate a couple of pages on my site.


  1. Thank you! I was searching for bibbase website. I used it before, but just could not remember its name!

    Thank you again!

Leave a comment

Your email address will not be published. Required fields are marked *