javadoc-cleanup

Overview

Latest release in the GitHub Marketplace

The javadoc-cleanup GitHub Action enables creating mobile-friendly and SEO ready, documentation sites by post-processing javadocs in GitHub Actions. The javadoc-cleanup GitHub action is a utility to tidy up javadocs prior to deployment to an API documentation website, assumed hosted on GitHub Pages. It performs the following functions.

Improved mobile browsing experience: It inserts appropriate viewport directives within the head of each html file that was generated by javadoc if not already present. Beginning with Java 16+, javadoc inserts appropriate viewport declarations to begin with, but earlier Java versions do not.

Strips out any timestamps inserted by javadoc: The timestamps cause a variety of version control issues for documentation sites maintained in git repositories. Javadoc has an option -notimestamp to direct javadoc not to insert timestamps (which we recommend that you also use). However, at the present time there appears to be a bug (in OpenJDK 11's javadoc, and possibly other versions), where the timestamp is not omitted in the overview-summary.html generated by javadoc.

Canonical URL generation: It is capable of generating and inserting the canonical URL for each javadoc page.

User-defined block insertion: It enables inserting a user-defined block into the head of each javadoc generated page. For example, this feature can come in handy if you want to insert a link to your site's favicon, or really anything else that is valid in the head of an html file.

Cleans up javadoc-generated redirects: In projects that use the Java Platform Module System (JPMS), javadoc redirects the root index.html to the page of a module, and under certain other circumstances to a package page. Such redirected pages should direct search engines to noindex, but javadoc doesn't do so. The javadoc-cleanup action inserts a noindex, follow directive in any such redirected pages.

The javadoc-cleanup GitHub Action is implemented in Python, and the source code repository is hosted on GitHub; and it is licensed under the MIT License. Also in the GitHub repository you will find detailed instructions for use including several sample GitHub workflows.

The javadoc-cleanup GitHub Action is developed by Vincent A. Cicirello. It was originally implemented for my own use, but I have decided to share it with others.

Live Examples

Tech Stack

The javadoc-cleanup GitHub Action utilizes the following:

Blog Posts About javadoc-cleanup

As the author of javadoc-cleanup, I occasionally post about this, and other software that I maintain on DEV.to. See my DEV.to profile for a full list of such posts. Below is a selection of blog posts specifically about javadoc-cleanup.