✨ Unpublish posts
This commit is contained in:
parent
3e162637f5
commit
ddb3af1f46
|
@ -82,6 +82,24 @@ find -L "$SOURCE_DIR" -type f -name "*.md" -exec grep -q "publish: true" {} \; -
|
||||||
fi
|
fi
|
||||||
done
|
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
|
# Print the log file
|
||||||
cat "$LOG_FILE"
|
cat "$LOG_FILE"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue