Bulk editing for API frontmatter
API frontmatter metadata is stored with the API content it describes. This makes sense in most cases, but sometimes you want to bulk edit metadata or compare phrasing across all API references. There are 2 scripts to help with this. They are currently written to edit the excerpts field, but can be adapted for other fields.
extract_excerpts.sh
This extracts the excerpt from every API reference into a single file named extracted_excerpts.md.
To use:
cdinto the_scripts/directory.- If you already have an
extracted_excerpts.mdfile from a previous run, delete it. - Run
./extract_excerpts.sh. - Open
extracted_excerpts.mdand edit the excerpts directly within the file. Only change the actual excerpts, not the filename orexcerpt:label. Otherwise, the next script fails.
insert_excerpts.sh
This takes the edited excerpts from extracted_excerpts.md and updates the original files with the new edits. A backup is created so the data is saved if something goes horribly wrong. (If something goes wrong with the backup, you can always also restore from git.)
To use:
- Save your edited
extracted_excerpts.md. - Make sure you are in the
_scripts/directory. - Run
./insert_excerpts.sh. - Run
git diffto double-check that the update worked correctly. - Delete the unnecessary backups.
===== PAGE: https://docs.tigerdata.com/navigation/index/ =====