When it came to the task of indexing our dev articles, including this one (meta right?), we decided to take the approach of directly reading the HTML documents of each article, combined with app configurations, to determine the title, description, image, body, and other properties to use for indexing. We store special properties in metadata tags: standard tags, og properties, and some custom tags specific to our website. Since we are using custom tags, the standard metadata tag processors do not pick them up; thus, we've created our own library to accomplish the task. The following sections show an example, then how to use the library for your own projects.
The data below shows the metadata tags for this page.
Our html-metadata-reader project holds functionality for some of the most common functional patterns. The project is available as a consumable package and the code is available on Git:
To get started now: you can directly install via npm:
Once installed, simply get some html document as a string, then pass it into the serivce to get the tags:
The default response will be an array of iDocumentMetadataTag. This contains data about the meta ta's declaration and the content+values themselves.
If you prefer a key/value representation (dictionary), you can use a formatter for that purpose:
Congrats, you made it to the end of the article! We think one of these articles below might be a good next step along your journey:
Feel free to check out some of our merch while you're here!
Thanks for reading! This page was last updated on 7/25/2021
Follow us on social media for updates and new dev pages and to help support our brand!
Fill out the form below and we'll send you an email reminder to visit this page again:
We've saved your reminder and will send you an email when the time comes.
Unfortunately, there was an error saving your reminder. Please try again.