Skip to content

Instantly share code, notes, and snippets.

@patx
Created December 15, 2025 07:33
Show Gist options
  • Select an option

  • Save patx/49bf14d9848913c50c82ecccbd746af4 to your computer and use it in GitHub Desktop.

Select an option

Save patx/49bf14d9848913c50c82ecccbd746af4 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>URL Shortened - Shorty</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
font-family: system-ui, -apple-system, sans-serif;
}
.container {
width: 90%;
max-width: 600px;
text-align: center;
}
h1 {
font-size: 2rem;
margin-bottom: 2rem;
}
.url-box {
padding: 1.5rem;
background: #f5f5f5;
border-radius: 8px;
margin-bottom: 1rem;
}
.short-url {
font-size: 1.3rem;
font-weight: bold;
word-break: break-all;
}
.copy-btn {
padding: 1rem 2rem;
font-size: 1.1rem;
background: #000;
color: #fff;
border: none;
border-radius: 8px;
cursor: pointer;
margin-top: 1rem;
}
.copy-btn:hover {
background: #333;
}
.back-link {
display: inline-block;
margin-top: 2rem;
color: #666;
text-decoration: none;
}
.back-link:hover {
color: #000;
}
</style>
</head>
<body>
<div class="container">
<h1>{{ url_id }}</h1>
<div class="url-box">
<div class="short-url" id="shortUrl">{{ url_root }}{{ short_id }}</div>
</div>
<button class="copy-btn" onclick="copyUrl()">Copy Link</button>
<br>
<a href="/" class="back-link">← Shorten another</a>
</div>
<script>
function copyUrl() {
const url = document.getElementById('shortUrl').textContent;
navigator.clipboard.writeText(url).then(() => {
const btn = document.querySelector('.copy-btn');
btn.textContent = 'Copied!';
setTimeout(() => btn.textContent = 'Copy Link', 2000);
});
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment