Skip to content

Commit

Permalink
updated shell script to use repo readme as project index
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronBrooks11 committed Jan 14, 2025
1 parent 6786a89 commit db1cd14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion _projects/sama
Submodule sama updated from 6af70b to 94f9a9
12 changes: 12 additions & 0 deletions sync_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ for project in _projects/*; do
cp -r "$project/assets"/* assets/
fi

# Check if README.md exists and create it as the project index
if [ -f "$project/README.md" ]; then
readme_file="$project/README.md"
readme_title=$(basename "$project" | sed -e 's/-/ /g' -e 's/\b\(.\)/\u\1/g')

# Check if front matter exists in the README
if ! grep -q "^---" "$readme_file"; then
# Add front matter with a proper permalink and title
echo -e "---\nlayout: project-index\ntitle: \"$readme_title\"\npermalink: /projects/$(basename "$project")/\n---\n$(cat "$readme_file")" > "$readme_file"
fi
fi

# Process each markdown file in docs
find "$project/docs" -name "*.md" | while read -r file; do
# Extract relative path from the docs folder and generate a URL-friendly title
Expand Down

0 comments on commit db1cd14

Please sign in to comment.