-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.html
More file actions
169 lines (144 loc) · 5.59 KB
/
post.html
File metadata and controls
169 lines (144 loc) · 5.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Blog | Namma Kudla</title>
<link rel="stylesheet" href="style.css"/>
<script src="https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2/dist/supabase.min.js"></script>
</head>
<body>
<header class="site-header">
<div class="container">
<h1>Namma Kudla Travel Blog</h1>
<nav class="nav">
<a href="index.html">Home</a>
<a href="post.html" class="active">Blog</a>
<a href="destinations.html">Destinations</a>
<div class="dropdown">
<button class="dropbtn">Dashboard</button>
<div class="dropdown-content">
<a href="about.html">About</a>
<a href="stories.html">Stories</a>
<a href="maps.html">Maps</a>
<a href="community.html">Community</a>
<a href="guide.html">Guides</a>
<a href="editor.html">Editor</a>
</div>
</div>
<a href="contact.html">Contact</a>
</nav>
</div>
</header>
<main class="blog-container">
<section class="blog-content">
<article class="post">
<h2>Exploring the Charm of Mangalore’s Coastline</h2>
<div class="meta">By <strong>Anoop A</strong> | Published on Oct 31, 2025</div>
<img src="beach.jpg" alt="Mangalore Beach" class="post-img">
<p>
Mangalore, fondly called “Kudla,” is a blend of rich culture, pristine beaches, and mouthwatering coastal cuisine.
Start your journey at Panambur Beach, known for its golden sands and lively festivals, then explore the traditional markets
and ancient temples that dot the region.
</p>
<p>
Whether you’re surfing the waves or enjoying a sunset by the Arabian Sea, Mangalore’s coastal charm leaves an unforgettable mark.
</p>
<iframe width="100%" height="300" src="https://www.youtube.com/embed/uPBIEkXQGK4"
title="Mangalore Travel Video" frameborder="0" allowfullscreen></iframe>
</article>
<!-- COMMENTS SECTION -->
<section class="comments">
<h3>Comments</h3>
<div id="comments-list"></div>
<form id="commentForm">
<input type="text" id="username" placeholder="Your name" required>
<textarea id="message" placeholder="Leave a comment..." required></textarea>
<button type="submit">Post Comment</button>
</form>
</section>
</section>
<aside class="sidebar">
<div class="sidebar-section">
<h4>Categories</h4>
<ul>
<li><a href="beaches.html">Beaches</a></li>
<li><a href="temples.html">Temples</a></li>
<li><a href="food.html">Food</a></li>
<li><a href="culture.html">Culture</a></li>
</ul>
</div>
<div class="sidebar-section">
<h4>Tags</h4>
<div class="tags">
<span>#Mangalore</span>
<span>#Travel</span>
<span>#Kudla</span>
<span>#Adventure</span>
<span>#Foodie</span>
</div>
</div>
<div class="sidebar-section">
<h4>Recent Posts</h4>
<ul>
<li><a href="#">Top 5 Hidden Beaches in Kudla</a></li>
<li><a href="#">A Foodie’s Guide to Mangalore</a></li>
<li><a href="#">Temples and Traditions of Tulunadu</a></li>
</ul>
</div>
</aside>
</main>
<footer>
<p>© 2025 Namma Kudla. All rights reserved.</p>
</footer>
<!-- SUPABASE COMMENTS SCRIPT -->
<script>
// 1. Initialize Supabase
const SUPABASE_URL = "https://jtwldauigxdgwivrrgxz.supabase.co";
const SUPABASE_ANON_KEY = "process.env.SUPABASE_KEY";
const db = supabase.createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
const form = document.getElementById("commentForm");
const commentsList = document.getElementById("comments-list");
// Escape HTML to avoid XSS
function clean(text) {
return text.replace(/</g, "<").replace(/>/g, ">");
}
// Fetch + Display Comments
async function fetchComments() {
const { data, error } = await db
.from("comments")
.select("*")
.order("created_at", { ascending: true });
commentsList.innerHTML = "";
if (data) {
data.forEach(comment => {
const html = `
<div class="comment-item">
<strong>${clean(comment.username)}</strong><br>
<span>${clean(comment.message)}</span>
</div>
`;
commentsList.insertAdjacentHTML("beforeend", html);
});
}
}
fetchComments();
// Submit Comment
form.addEventListener("submit", async (e) => {
e.preventDefault();
const username = document.getElementById("username").value.trim();
const message = document.getElementById("message").value.trim();
if (!username || !message) return;
const { data, error } = await db
.from("comments")
.insert([{ username, message }]);
if (error) {
alert("Error posting comment");
return;
}
form.reset();
fetchComments();
});
</script>
</body>
</html>