Skip to content

Commit

Permalink
Script to fix missing _index files for news translations
Browse files Browse the repository at this point in the history
These files are required to properly display images for news

Signed-off-by: Alexander Borsuk <[email protected]>
  • Loading branch information
biodranik authored and rtsisyk committed Jan 31, 2023
1 parent 6db2c4f commit afb8c35
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fix_news_translations.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# This script creates required _index files to properly process news translations.
# TODO: Automatize it or find a way to avoid required translated _index files.

set -euo pipefail

if [ -z ${1:-} ]; then
find content/news -type f -name 'index.*.md' -exec ./fix_news_translations.sh {} \;
else
PARENT_DIR="$(dirname $1)/.."
LANG_INDEX=$(basename $1)
rsync -a "$PARENT_DIR/_index.md" "$PARENT_DIR/_$LANG_INDEX"
fi

0 comments on commit afb8c35

Please sign in to comment.