Я нахожусь в процессе создания сценариев преобразования, чтобы переместить контент во что-то, что Hugo может поддерживать.Я все еще изучаю Bash, поэтому я подозреваю, что в логике этого раздела кода есть какая-то ошибка - по умолчанию используется последнее предложение "elif", которое просто создает новый _index.md по умолчанию, а не проверяет какие-либо другие предложения,
Любое руководство, указывающее мне правильное направление для отладки, будет оценено!
for d in `find ${CONTENT?} -type d ! -name 'media' ! -name 'releases' ! -name 'css' ! -name 'img'`
do
NAME=$(echo ${PWD##*/})
# Does index.md exist?
if [[ -f index.md ]]; then
echo_info "A base file already exists; renaming to _index.md."
mv ${d?}/index.md ${d?}/_index.md
# Does _index.md exist?
elif [[ -f _index.md ]]; then
echo_info "_index.md already exists for the selected content directory."
# Does a file exist with the same name as the directory?
elif [[ -f ${NAME?}.md ]]; then
echo_info "A base file already exists; renaming to _index.md."
mv ${d?}/${NAME?}.md ${d?}/_index.md
# If none of the above exist, default to creating a new _index.md.
elif [[ ! -f index.md || ! -f _index.md || ! -f ${NAME?}.md ]]; then
echo_info "Creating _index.md for directory."
cd ${BUILD?} && hugo new ${d?}/_index.md
fi
done