-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b5897a2
commit 6786a89
Showing
5 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
|
||
# Ensure the submodules are updated | ||
git submodule update --remote --merge | ||
|
||
# Loop through each project in the _projects folder | ||
for project in _projects/*; do | ||
if [ -d "$project/docs" ]; then | ||
# Copy assets folder (if it exists) | ||
if [ -d "$project/assets" ]; then | ||
cp -r "$project/assets"/* assets/ | ||
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 | ||
relative_path=${file#"$project/docs/"} | ||
filename=$(basename "$relative_path" .md) | ||
title=$(echo "$filename" | sed -e 's/-/ /g' -e 's/\b\(.\)/\u\1/g') | ||
|
||
# Check if front matter exists | ||
if ! grep -q "^---" "$file"; then | ||
# Add front matter with a proper permalink and title | ||
echo -e "---\nlayout: project-docs\ntitle: \"$title\"\npermalink: /projects/$(basename "$project")/docs/${relative_path%.md}/\n---\n$(cat "$file")" > "$file" | ||
fi | ||
done | ||
fi | ||
done | ||
|
||
echo "Documentation and assets synced, front matter added." |