diff --git a/scripts/publish.sh b/scripts/publish.sh index 5df80f5..2a00c0a 100755 --- a/scripts/publish.sh +++ b/scripts/publish.sh @@ -82,6 +82,24 @@ find -L "$SOURCE_DIR" -type f -name "*.md" -exec grep -q "publish: true" {} \; - fi done +# Find Markdown files with "publish: false" and process them +find -L "$SOURCE_DIR" -type f -name "*.md" -exec grep -q "publish: false" {} \; -exec grep -l "publish: false" {} + | while read -r markdown_file; do + # Extract relative path from the source directory + relative_path="${markdown_file#$SOURCE_DIR/}" + + # Destination path + dest_path="$DEST_DIR/$relative_path" + + # Check if the destination file exists + if [ -f "$dest_path" ]; then + # Remove the file from DEST_DIR + rm "$dest_path" + echo "Removed $markdown_file from $DEST_DIR" >> "$LOG_FILE" + else + echo "File $markdown_file not found in $DEST_DIR" >> "$LOG_FILE" + fi +done + # Print the log file cat "$LOG_FILE"