You can easily display your Mobilize events on your Duda site by adding custom HTML, CSS, and JavaScript. Follow these steps:
Go to your Duda Editor.
Navigate to Widgets → HTML (or drag an HTML widget onto your page).
Step 2: Add Your Code
Inside the HTML widget, paste the code as follows:
Note: This is sample code. Replace your_org_id_here and your_api_url_here with your own Mobilize organization ID and API endpoint.CSS (Styling your events)
Wrap this in <style> tags:
- <style>
- #mobilize-events {
- display: grid;
- grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
- gap: 20px;
- padding: 10px;
- }
- .mobilize-card {
- background: #ffffff;
- border-radius: 10px;
- padding: 20px;
- box-shadow: 0 4px 10px rgba(0,0,0,0.1);
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- }
- .mobilize-title {
- font-size: 1.2rem;
- font-weight: bold;
- margin-bottom: 10px;
- }
- .mobilize-date {
- font-size: 0.95rem;
- color: #444;
- margin-bottom: 8px;
- }
- .mobilize-location {
- font-size: 0.9rem;
- color: #666;
- margin-bottom: 12px;
- }
- .mobilize-button {
- background: #0057b8;
- color: white;
- padding: 10px 14px;
- text-align: center;
- border-radius: 6px;
- text-decoration: none;
- font-weight: bold;
- transition: background 0.2s ease;
- }
- .mobilize-button:hover {
- background: #003f86;
- }
- </style>
JavaScript (Fetch and display events)
Wrap this in <script> tags. Replace the placeholders with your actual values:
- <script>
- const ORG_ID = your_org_id_here; // Replace with your own Mobilize org ID
- const API_URL = 'your_api_url_here'; // Replace with your own API URL
- async function fetchEvents() {
- try {
- const response = await fetch(API_URL);
- const data = await response.json();
- renderEvents(data.data);
- } catch (error) {
- document.getElementById("mobilize-events").innerHTML =
- "<p>Unable to load events right now.</p>";
- }
- }
- function formatDate(dateStr) {
- const date = new Date(dateStr * 1000);
- return date.toLocaleString("en-US", {
- weekday: "short",
- month: "short",
- day: "numeric",
- hour: "numeric",
- minute: "2-digit"
- });
- }
- function renderEvents(events) {
- const container = document.getElementById("mobilize-events");
- container.innerHTML = "";
- events.forEach(event => {
- const title = event.title;
- const location = event.location?.venue || "Online Event";
- const timeslot = event.timeslots?.[0];
- const start = timeslot ? formatDate(timeslot.start_date) : "TBA";
- const url = event.browser_url;
- const card = `
- <div class="mobilize-card">
- <div>
- <div class="mobilize-title">${title}</div>
- <div class="mobilize-date">${start}</div>
- <div class="mobilize-location">${location}</div>
- </div>
- <a class="mobilize-button" href="${url}" target="_blank">
- Sign Up
- </a>
- </div>
- `;
- container.innerHTML += card;
- });
- }
- fetchEvents();
- </script>
HTML (Where the events will show up)
Paste this inside the same widget:
<div id="mobilize-events"></div>
Step 3: Publish Your Page
Save the widget.
Publish your page.
Your Mobilize events will now:
Auto‑update with new events
Display in a responsive grid
Require no extra maintenance
Reminder: This is sample code. Replace your_org_id_here and your_api_url_here with your own details.
Thank you.