@@ -91,6 +91,13 @@ title: Home
91
91
</article>
92
92
</div>
93
93
</div>
94
+ <header>
95
+ <h2></h2>
96
+ </header>
97
+ <header>
98
+ <h2>LAB WalkThrough</h2>
99
+ </header>
100
+ <div id="wordpress-feed"></div>
94
101
</div>
95
102
</section >
96
103
@@ -99,7 +106,6 @@ title: Home
99
106
const sections = document .querySelectorAll (' section' );
100
107
sections .forEach (section => section .style .display = ' none' );
101
108
102
- // Function to show the selected section and hide others
103
109
function showSection (selectedId ) {
104
110
sections .forEach (section => {
105
111
if (section .id === selectedId) {
@@ -110,7 +116,6 @@ title: Home
110
116
});
111
117
}
112
118
113
- // Add event listeners for navigation (modify this part according to your navigation setup)
114
119
document .querySelectorAll (' nav a' ).forEach (link => {
115
120
link .addEventListener (' click' , function (e ) {
116
121
e .preventDefault ();
@@ -119,25 +124,36 @@ title: Home
119
124
});
120
125
});
121
126
122
- // Show the home section by default
123
127
showSection (' home' );
124
128
125
- // Medium RSS feed integration
126
129
async function fetchMediumRSS () {
127
130
const rssFeedUrl = ' https://medium.com/feed/@bibib' ;
128
131
const rssToJsonUrl = ` https://api.rss2json.com/v1/api.json?rss_url=${ encodeURIComponent (rssFeedUrl)} ` ;
129
132
130
133
try {
131
134
const response = await fetch (rssToJsonUrl);
132
135
const data = await response .json ();
133
- displayFeed (data);
136
+ displayFeed (data, ' medium-feed' );
137
+ } catch (error) {
138
+ console .error (' Error fetching Medium RSS feed:' , error);
139
+ }
140
+ }
141
+
142
+ async function fetchWordPressRSS () {
143
+ const rssFeedUrl = ' https://nbsc7.wordpress.com/feed' ; // Replace with your WordPress RSS feed URL
144
+ const rssToJsonUrl = ` https://api.rss2json.com/v1/api.json?rss_url=${ encodeURIComponent (rssFeedUrl)} ` ;
145
+
146
+ try {
147
+ const response = await fetch (rssToJsonUrl);
148
+ const data = await response .json ();
149
+ displayFeed (data, ' wordpress-feed' );
134
150
} catch (error) {
135
- console .error (' Error fetching RSS feed:' , error);
151
+ console .error (' Error fetching WordPress RSS feed:' , error);
136
152
}
137
153
}
138
154
139
- function displayFeed (data ) {
140
- const feedContainer = document .getElementById (' medium-feed ' );
155
+ function displayFeed (data , containerId ) {
156
+ const feedContainer = document .getElementById (containerId );
141
157
const items = data .items ;
142
158
143
159
items .forEach (item => {
@@ -150,5 +166,6 @@ title: Home
150
166
}
151
167
152
168
fetchMediumRSS ();
169
+ fetchWordPressRSS ();
153
170
});
154
- </script >
171
+ </script >
0 commit comments