-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.html
More file actions
42 lines (37 loc) · 1.17 KB
/
Copy pathpost.html
File metadata and controls
42 lines (37 loc) · 1.17 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Post</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="postContainer"></div>
<footer>
<p>© 2025 StacikDev. All rights reserved.</p>
</footer>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script>
async function loadPost() {
// Example: URL: https://frontend.com/post.html?id=1762027735214
const params = new URLSearchParams(window.location.search);
const postId = params.get('id');
if (!postId) {
document.getElementById('postContainer').innerHTML = '<p>No post ID provided</p>';
return;
}
try {
const res = await fetch(`https://server.ctksystem.com/post/${postId}`);
if (!res.ok) throw new Error('Post not found');
const post = await res.json();
document.getElementById('postContainer').innerHTML =
`<h1>${post.title}</h1>` + marked.parse(post.content);
} catch (err) {
document.getElementById('postContainer').innerHTML = `<p>${err.message}</p>`;
}
}
loadPost();
</script>
</body>
</html>