Hi everyone,
I’m wondering if in Hugo it’s possible to skip certain blocks present in a .md file and exclude them from the built page.
In particular I would like to skip something like this:
---
Annotations: 0,6310 SHA-256 0650af9e723d7401b1a63e81582eb7bd
@Anton Sotkov: 15 20,107 128,186 490,642 1319 1562,632 2197,29 2227,18 2267,356 2624,15 2680,19 2705,21 2732,14 2752,4 2764,2846 5611,699
@Oliver Reichenstein: 314,176
@Iain Humm: 2194,3 2226 2245,22 2623 2639,40 2699,6 2726,6 2746,6 2756,8 5610
...
which is something that iA Writer (an editor for MarkDown) automatically adds at the end of the file in case you use their latests authorship feature.
I reckon this is not standard MarkDown and that it shouldn’t be added to the file, but here we are.
In case Hugo doesn’t have a native way to configure blocks to be skipped, I’m going to run a script like this:
#!/bin/bash
# Directory where your Markdown files are located
CONTENT_DIR="path/to/your/content"
# Find all Markdown files and process them
find "$CONTENT_DIR" -type f -name "*.md" | while read -r file; do
# Use sed to remove the lines between "--- Annotations" and "..."
# -i.bak creates a backup before modifying the file
sed -i.bak '/--- Annotations/,/\.\.\./d' "$file"
# Optionally, remove the backup file if you're confident the changes are correct
rm "${file}.bak"
done
in my building pipeline, but if I could use a native way I would be happier.
Thank you so much.