md-to-page.sh 495 B

12345678910111213141516171819202122232425
  1. #!/bin/bash
  2. # copy a markdown file to md-pages with a flattened filename
  3. # and a header.
  4. FILE="$1"
  5. TITLE="${2:-$FILE}"
  6. LAYOUT="${LAYOUT:-:page}"
  7. PAGE_INDEX="${PAGE_INDEX:-4000}"
  8. IS_NAVBAR="${IS_NAVBAR:-true}"
  9. GENERATED_AT="${GENERATED_AT:-$(date +%s)}"
  10. LAST_MODIFIED="${LAST_MODIFIED:-$(stat -c %Y $FILE)}"
  11. cat <<HEADER_META
  12. {:layout $LAYOUT
  13. :title "$TITLE"
  14. :page-index $PAGE_INDEX
  15. :navbar? $IS_NAVBAR
  16. :generated-at $GENERATED_AT
  17. :last-modified $LAST_MODIFIED
  18. }
  19. HEADER_META
  20. cat $FILE