docmachine-containers/utils/docs/build_metadata.sh

33 lines
464 B
Bash
Executable file

#!/bin/sh
set -ue
MKDOCS_YML_FILE="${1:-}"
OUTPUT_FILE="${2:-}"
gx_usage() {
echo "Usage: $0 <mkdocs_yml_file> <output_file>"
echo ""
}
if [ -z "$MKDOCS_YML_FILE" ]; then
gx_usage
exit 1
fi
if [ -z "$OUTPUT_FILE" ]; then
gx_usage
exit 1
fi
TITLE="$(yq -r '.site_name' < "$MKDOCS_YML_FILE")"
AUTHOR="$(yq -r '.site_author' < "$MKDOCS_YML_FILE")"
cat > "$OUTPUT_FILE" <<-MARK
---
title: Formation
subtitle: "$TITLE"
author: "$AUTHOR"
date: \today
MARK