-RADICAL - The Underground Parliament
-
-
-
-
-
-
-
+The Radical Party | Direct Democracy for Australia
+
+
+
+
+
+
+
-
+ content="The Radical Party: Australia's direct democracy movement. One policy — 100,000 signatures forces a binding referendum. Post ideas, build movements, take back control.">
+
+ content="The Radical Party: Australia's direct democracy movement. One policy — 100,000 signatures forces a binding referendum. Post ideas, build movements, take back control.">
+ content="The Radical Party is an Australian political party promoting direct democracy through Citizens Initiated Referendums.">
+ content="The Radical Party: Australia's direct democracy movement. One policy — 100,000 signatures forces a binding referendum. Post ideas, build movements, take back control.">
-
@@ -278,7 +277,7 @@
+ content="The Radical Party, radical party australia, direct democracy australia, citizens initiated referendum, CIR australia, radical, democracy, petitions, policy, activism">
@@ -287,29 +286,53 @@
+
diff --git a/worker.js b/worker.js
index 2e27a2b..ee3f9ed 100644
--- a/worker.js
+++ b/worker.js
@@ -104,6 +104,17 @@ export default {
return serveStaticAsset(request, env);
}
+ if (path === '/robots.txt') {
+ return new Response(
+ 'User-agent: *\nAllow: /\nSitemap: https://theradicalparty.com/sitemap.xml\n',
+ { headers: { 'Content-Type': 'text/plain', 'Cache-Control': 'public, max-age=86400' } }
+ );
+ }
+
+ if (path === '/sitemap.xml') {
+ return serveSitemap(request, env);
+ }
+
// Handle media files
if (path.startsWith('/memes/') || path.startsWith('/audio/')) {
return serveMedia(request, env);
@@ -226,6 +237,63 @@ async function serveMedia(request, env) {
}
}
+async function serveSitemap(request, env) {
+ try {
+ const topProposals = await env.DB.prepare(`
+ SELECT p.id, p.timestamp,
+ (SELECT COUNT(*) FROM votes WHERE proposal_id = p.id AND vote_type = 'upvote') as upvotes
+ FROM proposals p
+ WHERE (p.hidden = 0 OR p.hidden IS NULL)
+ ORDER BY upvotes DESC
+ LIMIT 50
+ `).all();
+
+ const base = 'https://theradicalparty.com';
+ const now = new Date().toISOString().split('T')[0];
+
+ let urls = `
+
+ ${base}/
+ ${now}
+ hourly
+ 1.0
+ `;
+
+ for (const p of (topProposals.results || [])) {
+ const date = new Date(p.timestamp).toISOString().split('T')[0];
+ urls += `
+
+ ${base}/?proposal=${p.id}
+ ${date}
+ weekly
+ 0.6
+ `;
+ }
+
+ const xml = `
+${urls}
+`;
+
+ return new Response(xml, {
+ headers: {
+ 'Content-Type': 'application/xml',
+ 'Cache-Control': 'public, max-age=3600',
+ },
+ });
+ } catch (error) {
+ console.error('Error serving sitemap:', error);
+ const xml = `
+
+
+ https://theradicalparty.com/
+ hourly
+ 1.0
+
+`;
+ return new Response(xml, { headers: { 'Content-Type': 'application/xml' } });
+ }
+}
+
// Handle static assets
async function serveStaticAsset(request, env) {
try {