You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Create pageviews badge data JSON file (dark purple)
112
-
cat > badge-data-pageviews.json << EOF
113
-
{
114
-
"schemaVersion": 1,
115
-
"label": "Total Views",
116
-
"message": "$pageviews_value",
117
-
"color": "2d0e2d",
118
-
"cacheSeconds": 86400
119
-
}
120
-
EOF
111
+
# URL encode the values (replace spaces and special chars)
112
+
pageviews_encoded=$(echo "$pageviews_value" | sed 's/ /%20/g')
113
+
visitors_encoded=$(echo "$visitors_value" | sed 's/ /%20/g')
121
114
122
-
# Create unique visitors badge data JSON file (light purple)
123
-
cat > badge-data-visitors.json << EOF
124
-
{
125
-
"schemaVersion": 1,
126
-
"label": "Unique Visitors",
127
-
"message": "$visitors_value",
128
-
"color": "c8a3c8",
129
-
"cacheSeconds": 86400
130
-
}
131
-
EOF
115
+
# Update the README.md with new badge URLs (for-the-badge style)
116
+
# Look for existing badge lines and replace them, or add them if not found
117
+
if grep -q "Total%20Views" README.md; then
118
+
# Replace existing pageviews badge
119
+
sed -i "s|!\[Total Views\].*||" README.md
120
+
else
121
+
# Add pageviews badge if not found (after # OpenWashData Website line)
122
+
sed -i '/# OpenWashData Website/a\\n' README.md
123
+
fi
124
+
125
+
if grep -q "Unique%20Visitors" README.md; then
126
+
# Replace existing visitors badge
127
+
sed -i "s|!\[Unique Visitors\].*||" README.md
128
+
else
129
+
# Add visitors badge if not found (after pageviews badge)
130
+
sed -i '/Total%20Views.*-2d0e2d/a' README.md
131
+
fi
132
132
133
-
echo "Badge files created successfully:"
134
-
ls -la badge-data-*.json
135
-
echo "Content of pageviews badge:"
136
-
cat badge-data-pageviews.json
137
-
echo "Content of visitors badge:"
138
-
cat badge-data-visitors.json
133
+
echo "README updated with new badge URLs"
134
+
echo "Updated badges:"
135
+
grep -E "!\[(Total Views|Unique Visitors)\]" README.md || echo "No badges found in README"
0 commit comments