Skip to content

Commit b48453c

Browse files
committed
updated community feed
1 parent 05a8b2d commit b48453c

13 files changed

Lines changed: 931 additions & 125 deletions

File tree

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
2+
const fetch = require('node-fetch');
3+
const fs = require('fs');
4+
5+
const DISCOURSE_URL = 'https://forums.powershell.org';
6+
7+
async function fetchDiscourseActivity() {
8+
try {
9+
const activities = [];
10+
11+
// 1. Get latest topics
12+
const topicsResponse = await fetch(`${DISCOURSE_URL}/latest.json`);
13+
const topicsData = await topicsResponse.json();
14+
15+
// Get 2 most recent topics
16+
topicsData.topic_list.topics.slice(0, 2).forEach(topic => {
17+
activities.push({
18+
message: topic.title.length > 50 ? topic.title.substring(0, 50) + '...' : topic.title,
19+
time: getRelativeTime(topic.created_at),
20+
type: 'topic',
21+
color: 'bg-blue-500',
22+
url: `${DISCOURSE_URL}/t/${topic.slug}/${topic.id}`
23+
});
24+
});
25+
26+
// 2. Get site statistics
27+
const statsResponse = await fetch(`${DISCOURSE_URL}/site/statistics.json`);
28+
const statsData = await statsResponse.json();
29+
30+
// Add a stats-based activity
31+
activities.push({
32+
message: `${statsData.topics_7_days || 0} new topics this week`,
33+
time: 'This week',
34+
type: 'stats',
35+
color: 'bg-green-500'
36+
});
37+
38+
// 3. Get recent posts (if API allows)
39+
try {
40+
const postsResponse = await fetch(`${DISCOURSE_URL}/posts.json`);
41+
const postsData = await postsResponse.json();
42+
43+
if (postsData.latest_posts && postsData.latest_posts.length > 0) {
44+
const recentPost = postsData.latest_posts[0];
45+
activities.push({
46+
message: `New reply in "${recentPost.topic_title ? recentPost.topic_title.substring(0, 40) + '...' : 'discussion'}"`,
47+
time: getRelativeTime(recentPost.created_at),
48+
type: 'reply',
49+
color: 'bg-purple-500'
50+
});
51+
}
52+
} catch (error) {
53+
console.log('Posts endpoint not available, skipping...');
54+
}
55+
56+
// 4. Create community stats object
57+
const communityStats = {
58+
activities: activities.slice(0, 4), // Limit to 4 items
59+
stats: {
60+
total_topics: statsData.topics_count || 0,
61+
total_posts: statsData.posts_count || 0,
62+
active_users: statsData.users_count || 0,
63+
topics_this_week: statsData.topics_7_days || 0
64+
},
65+
last_updated: new Date().toISOString()
66+
};
67+
68+
// Save to Hugo data file
69+
fs.writeFileSync('./data/community-stats.json', JSON.stringify(communityStats, null, 2));
70+
71+
console.log('✅ Discourse activity fetched successfully');
72+
console.log(`📊 Found ${activities.length} activities`);
73+
console.log(`👥 ${communityStats.stats.active_users} total users`);
74+
75+
} catch (error) {
76+
console.error('❌ Error fetching Discourse data:', error);
77+
78+
// Fallback to static data if API fails
79+
const fallbackData = {
80+
activities: [
81+
{
82+
message: "PowerShell 7.4.1 released with security updates",
83+
time: "Last week",
84+
type: "release",
85+
color: "bg-green-500"
86+
},
87+
{
88+
message: "New Azure PowerShell module available",
89+
time: "2 weeks ago",
90+
type: "update",
91+
color: "bg-blue-500"
92+
},
93+
{
94+
message: "Community module spotlight: PSWriteHTML",
95+
time: "3 weeks ago",
96+
type: "community",
97+
color: "bg-purple-500"
98+
},
99+
{
100+
message: "PowerShell Gallery security improvements",
101+
time: "1 month ago",
102+
type: "security",
103+
color: "bg-orange-500"
104+
}
105+
],
106+
stats: {
107+
total_topics: 0,
108+
total_posts: 0,
109+
active_users: 0,
110+
topics_this_week: 0
111+
},
112+
last_updated: new Date().toISOString(),
113+
fallback: true
114+
};
115+
116+
fs.writeFileSync('./data/community-stats.json', JSON.stringify(fallbackData, null, 2));
117+
}
118+
}
119+
120+
function getRelativeTime(dateString) {
121+
const now = new Date();
122+
const date = new Date(dateString);
123+
const diffMs = now - date;
124+
const diffHours = Math.floor(diffMs / (1000 * 60 * 60));
125+
126+
if (diffHours < 1) return 'Just now';
127+
if (diffHours < 24) return `${diffHours} hours ago`;
128+
const diffDays = Math.floor(diffHours / 24);
129+
if (diffDays === 1) return 'Yesterday';
130+
if (diffDays < 7) return `${diffDays} days ago`;
131+
const diffWeeks = Math.floor(diffDays / 7);
132+
if (diffWeeks === 1) return 'Last week';
133+
if (diffWeeks < 4) return `${diffWeeks} weeks ago`;
134+
return 'Last month';
135+
}
136+
137+
// Run the function
138+
fetchDiscourseActivity();
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Update Community Stats
2+
3+
on:
4+
schedule:
5+
- cron: '0 */4 * * *' # Every 4 hours
6+
workflow_dispatch:
7+
8+
jobs:
9+
update-community:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '18'
19+
20+
- name: Install dependencies
21+
run: npm install node-fetch
22+
23+
- name: Fetch Discourse activity
24+
run: node .github/scripts/fetch-discourse-activity.js
25+
26+
- name: Commit updates
27+
run: |
28+
git config --local user.email "action@github.com"
29+
git config --local user.name "GitHub Action"
30+
git add data/community-stats.json
31+
git diff --staged --quiet || git commit -m "Update community stats"
32+
git push

hugo.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ params:
8080
title: "PowerShell + DevOps Global Summit"
8181
dates: "April 28 - May 1, 2025"
8282
location: "Bellevue, WA"
83-
registration_url: "#"
83+
registration_url: "https://powershellsummit.org"
8484

8585
# Analytics (GitHub Pages compatible)
8686
google_analytics: ""

public/authors/index.html

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,21 @@
5454
}
5555

5656
.hero-pattern {
57+
background: linear-gradient(135deg, #0078D4 0%, #00BCF2 100%);
58+
position: relative;
59+
}
60+
61+
.hero-pattern::before {
62+
content: '';
63+
position: absolute;
64+
top: 0;
65+
left: 0;
66+
right: 0;
67+
bottom: 0;
5768
background-image:
58-
radial-gradient(circle at 25% 25%, rgba(0, 188, 242, 0.1) 0%, transparent 50%),
59-
radial-gradient(circle at 75% 75%, rgba(0, 120, 212, 0.1) 0%, transparent 50%);
69+
radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
70+
radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
71+
pointer-events: none;
6072
}
6173

6274
.podcast-card:hover {
@@ -111,6 +123,49 @@
111123
-webkit-box-orient: vertical;
112124
overflow: hidden;
113125
}
126+
127+
128+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
129+
130+
131+
.gotham-black {
132+
font-family: 'Inter', 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
133+
font-weight: 900;
134+
letter-spacing: -0.02em;
135+
}
136+
137+
.gotham-bold {
138+
font-family: 'Inter', 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
139+
font-weight: 700;
140+
letter-spacing: -0.01em;
141+
}
142+
143+
.gotham-medium {
144+
font-family: 'Inter', 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
145+
font-weight: 500;
146+
}
147+
148+
149+
.conference-gradient {
150+
background: linear-gradient(135deg, #0082c6 0%, #00aeef 50%, #2b2d78 100%);
151+
}
152+
153+
154+
@keyframes float {
155+
156+
0%,
157+
100% {
158+
transform: translateY(0px) rotate(0deg);
159+
}
160+
161+
50% {
162+
transform: translateY(-20px) rotate(180deg);
163+
}
164+
}
165+
166+
.float {
167+
animation: float 20s ease-in-out infinite;
168+
}
114169
</style>
115170

116171

@@ -183,7 +238,7 @@ <h1 class="text-xl font-bold text-gray-900">PowerShell.org</h1>
183238

184239

185240
<div class="hidden md:flex items-center space-x-4">
186-
<a href="#"
241+
<a href="https://powershellsummit.org"
187242
class="summit-gradient text-white px-4 py-2 rounded-lg text-sm font-medium hover:opacity-90 transition-opacity duration-200">
188243
Summit 2025
189244
</a>
@@ -250,7 +305,7 @@ <h1 class="text-xl font-bold text-gray-900">PowerShell.org</h1>
250305
</a>
251306

252307
<div class="pt-2 border-t border-gray-200">
253-
<a href="#"
308+
<a href="https://powershellsummit.org"
254309
class="block summit-gradient text-white px-3 py-2 rounded-lg text-center font-medium hover:opacity-90 transition-opacity duration-200">
255310
Register for Summit 2025
256311
</a>
@@ -378,7 +433,7 @@ <h3 class="text-lg font-semibold text-white mb-4">Upcoming Events</h3>
378433
<div class="bg-gray-800 p-4 rounded-lg">
379434
<h4 class="font-medium text-white mb-1">PowerShell &#43; DevOps Global Summit</h4>
380435
<p class="text-sm text-gray-400 mb-2">April 28 - May 1, 2025</p>
381-
<a href="#"
436+
<a href="https://powershellsummit.org"
382437
class="text-blue-400 hover:text-blue-300 text-sm font-medium transition-colors duration-200">
383438
Learn More →
384439
</a>

public/categories/index.html

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,21 @@
5454
}
5555

5656
.hero-pattern {
57+
background: linear-gradient(135deg, #0078D4 0%, #00BCF2 100%);
58+
position: relative;
59+
}
60+
61+
.hero-pattern::before {
62+
content: '';
63+
position: absolute;
64+
top: 0;
65+
left: 0;
66+
right: 0;
67+
bottom: 0;
5768
background-image:
58-
radial-gradient(circle at 25% 25%, rgba(0, 188, 242, 0.1) 0%, transparent 50%),
59-
radial-gradient(circle at 75% 75%, rgba(0, 120, 212, 0.1) 0%, transparent 50%);
69+
radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
70+
radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.02) 0%, transparent 40%);
71+
pointer-events: none;
6072
}
6173

6274
.podcast-card:hover {
@@ -111,6 +123,49 @@
111123
-webkit-box-orient: vertical;
112124
overflow: hidden;
113125
}
126+
127+
128+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');
129+
130+
131+
.gotham-black {
132+
font-family: 'Inter', 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
133+
font-weight: 900;
134+
letter-spacing: -0.02em;
135+
}
136+
137+
.gotham-bold {
138+
font-family: 'Inter', 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
139+
font-weight: 700;
140+
letter-spacing: -0.01em;
141+
}
142+
143+
.gotham-medium {
144+
font-family: 'Inter', 'Gotham', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
145+
font-weight: 500;
146+
}
147+
148+
149+
.conference-gradient {
150+
background: linear-gradient(135deg, #0082c6 0%, #00aeef 50%, #2b2d78 100%);
151+
}
152+
153+
154+
@keyframes float {
155+
156+
0%,
157+
100% {
158+
transform: translateY(0px) rotate(0deg);
159+
}
160+
161+
50% {
162+
transform: translateY(-20px) rotate(180deg);
163+
}
164+
}
165+
166+
.float {
167+
animation: float 20s ease-in-out infinite;
168+
}
114169
</style>
115170

116171

@@ -183,7 +238,7 @@ <h1 class="text-xl font-bold text-gray-900">PowerShell.org</h1>
183238

184239

185240
<div class="hidden md:flex items-center space-x-4">
186-
<a href="#"
241+
<a href="https://powershellsummit.org"
187242
class="summit-gradient text-white px-4 py-2 rounded-lg text-sm font-medium hover:opacity-90 transition-opacity duration-200">
188243
Summit 2025
189244
</a>
@@ -250,7 +305,7 @@ <h1 class="text-xl font-bold text-gray-900">PowerShell.org</h1>
250305
</a>
251306

252307
<div class="pt-2 border-t border-gray-200">
253-
<a href="#"
308+
<a href="https://powershellsummit.org"
254309
class="block summit-gradient text-white px-3 py-2 rounded-lg text-center font-medium hover:opacity-90 transition-opacity duration-200">
255310
Register for Summit 2025
256311
</a>
@@ -378,7 +433,7 @@ <h3 class="text-lg font-semibold text-white mb-4">Upcoming Events</h3>
378433
<div class="bg-gray-800 p-4 rounded-lg">
379434
<h4 class="font-medium text-white mb-1">PowerShell &#43; DevOps Global Summit</h4>
380435
<p class="text-sm text-gray-400 mb-2">April 28 - May 1, 2025</p>
381-
<a href="#"
436+
<a href="https://powershellsummit.org"
382437
class="text-blue-400 hover:text-blue-300 text-sm font-medium transition-colors duration-200">
383438
Learn More →
384439
</a>

0 commit comments

Comments
 (0)