Skip to content

Commit fb824fa

Browse files
authored
Merge pull request #65 from QwenLM/add_redirect
redirect to new blog
2 parents fe0bdc2 + c9c20c1 commit fb824fa

File tree

4 files changed

+196
-0
lines changed

4 files changed

+196
-0
lines changed

config.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ params:
4949
disable_language_switch: true
5050
displayFullLangName: true
5151

52+
# for redirect
53+
redirect: true
54+
redirect_url: https://qwen.ai/research
55+
redirect_title: We have a new blog at [qwen.ai](https://qwen.ai/research)!
56+
5257
# custom site and page variables
5358
show_share_buttons: true
5459
show_bread_crumbs: true

layouts/partials/redirect.html

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
<style>
2+
/* Modal Background Overlay */
3+
.modal-overlay {
4+
position: fixed;
5+
top: 0;
6+
left: 0;
7+
width: 100%;
8+
height: 100%;
9+
background-color: rgba(0, 0, 0, 0.5);
10+
display: flex;
11+
align-items: center;
12+
z-index: 1000;
13+
animation: fadeIn 0.3s ease-in-out;
14+
}
15+
16+
/* Modal Container */
17+
.modal-container {
18+
margin-left: auto;
19+
margin-right: auto;
20+
background-color: var(--theme);
21+
border-radius: 8px;
22+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
23+
width: 90%;
24+
max-width: 420px;
25+
height: fit-content;
26+
padding: 30px;
27+
text-align: center;
28+
position: relative;
29+
animation: slideIn 0.4s ease-out;
30+
}
31+
32+
.modal-container a {
33+
color: var(--hero2);
34+
}
35+
36+
/* Modal Icon */
37+
.modal-icon {
38+
width: 70px;
39+
height: 70px;
40+
background-color: #f0f7ff;
41+
border-radius: 50%;
42+
display: flex;
43+
align-items: center;
44+
justify-content: center;
45+
margin: 0 auto 20px;
46+
color: #1a73e8;
47+
font-size: 30px;
48+
}
49+
50+
/* Modal Title */
51+
.modal-title {
52+
font-size: 1.5rem;
53+
font-weight: 600;
54+
color: var(--primary);
55+
margin: 0 0 15px;
56+
}
57+
58+
/* Modal Message */
59+
.modal-message {
60+
font-size: 1rem;
61+
color: var(--secondary);
62+
line-height: 1.5;
63+
margin: 0 0 25px;
64+
}
65+
66+
67+
/* Countdown Timer */
68+
.countdown {
69+
font-size: 1.2rem;
70+
color: #666;
71+
margin: 20px 0;
72+
font-weight: 500;
73+
}
74+
75+
/* Button Container */
76+
.modal-buttons {
77+
display: flex;
78+
justify-content: center;
79+
gap: 15px;
80+
margin-top: 25px;
81+
}
82+
83+
/* Buttons */
84+
.modal-buttons .btn {
85+
padding: 6px 16px;
86+
border-radius: 8px;
87+
font-size: 1.2rem;
88+
font-weight: 500;
89+
cursor: pointer;
90+
transition: all 0.3s ease;
91+
border: none;
92+
}
93+
94+
.btn-primary {
95+
background-color: #1a73e8;
96+
color: white;
97+
}
98+
99+
.btn-primary:hover {
100+
background-color: #1557b0;
101+
}
102+
103+
.btn-secondary {
104+
background-color: #f1f3f4;
105+
color: #333;
106+
}
107+
108+
.btn-secondary:hover {
109+
background-color: #e0e0e0;
110+
}
111+
112+
/* Animations */
113+
@keyframes fadeIn {
114+
from { opacity: 0; }
115+
to { opacity: 1; }
116+
}
117+
118+
@keyframes slideIn {
119+
from {
120+
opacity: 0;
121+
transform: translateY(-50px);
122+
}
123+
to {
124+
opacity: 1;
125+
transform: translateY(0);
126+
}
127+
}
128+
129+
/* Responsive Design */
130+
@media (max-width: 480px) {
131+
.modal-container {
132+
max-width: 95%;
133+
width: calc(95vw - 40px);
134+
padding: 20px;
135+
}
136+
}
137+
</style>
138+
<div class="modal-overlay">
139+
<div class="modal-container">
140+
<div class="modal-icon">
141+
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
142+
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path>
143+
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path>
144+
</svg>
145+
</div>
146+
147+
<h2 class="modal-title">{{ site.Params.redirect_title | markdownify }}</h2>
148+
149+
<p class="modal-message">
150+
This page will automatically redirect in <span class="countdown" id="countdown">5</span> seconds.
151+
</p>
152+
153+
<p class="modal-message">
154+
If you are not redirected automatically, please click the button below.
155+
</p>
156+
157+
<div class="modal-buttons">
158+
<button class="btn btn-primary" onclick="redirectToPage()">Go Now</button>
159+
</div>
160+
</div>
161+
</div>
162+
163+
<script>
164+
// Countdown timer
165+
let countdown = 5;
166+
const countdownElement = document.getElementById('countdown');
167+
168+
const timer = setInterval(() => {
169+
countdown--;
170+
countdownElement.textContent = countdown;
171+
172+
if (countdown <= 0) {
173+
clearInterval(timer);
174+
}
175+
}, 1000);
176+
177+
function stayHere() {
178+
document.querySelector('.modal-overlay').style.display = 'none';
179+
}
180+
181+
function redirectToPage() {
182+
window.location.href = "{{ site.Params.redirect_url | safeHTML }}";
183+
}
184+
</script>

themes/PaperMod/layouts/partials/head.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<meta charset="utf-8">
22
<meta http-equiv="X-UA-Compatible" content="IE=edge">
3+
{{- if site.Params.redirect }}
4+
<meta http-equiv="Refresh" content='5; url="{{ site.Params.redirect_url | safeHTML }}"'>
5+
{{- end }}
36
{{- if eq .Kind "404" }}
47
<meta http-equiv="Refresh" content='5; url={{ "/" | absURL | safeHTML }}'>
58
{{- end }}

themes/PaperMod/layouts/partials/header.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
const hasHeaderBg = {{ $hasHeaderBg }};
4545
</script>
4646

47+
{{- if site.Params.redirect }}
48+
{{ partial "redirect.html" }}
49+
{{- end }}
50+
4751
{{ $sites := .Sites }}
4852

4953
<header class="header">

0 commit comments

Comments
 (0)