comments-page-bundles.sh 507 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. #!/bin/sh
  3. cd "$(dirname "${0}")" || exit 1
  4. for src in content/posts/*.md
  5. do
  6. echo "${src}"
  7. dir="$(dirname "${src}")/$(basename "${src}" .md)"
  8. mkdir "${dir}" ; git mv "${src}" "${dir}/index.md"
  9. done
  10. for dst in content/posts/*/index.md
  11. do
  12. dir="$(dirname "${dst}")"
  13. grep -F "url: " "${dir}/index.md" | cut -c 6- | while read -r url
  14. do
  15. src="static${url}comments"
  16. [ -r "${src}.xml" ] && git mv "${src}.xml" "${dir}/"
  17. [ -r "${src}.raw" ] && mv "${src}.raw" "${dir}/"
  18. done
  19. done