Add preview handling
This commit is contained in:
96
test-preview.html
Normal file
96
test-preview.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test Strapi Preview Implementation</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: system-ui, sans-serif;
|
||||
max-width: 800px;
|
||||
margin: 2rem auto;
|
||||
padding: 0 1rem;
|
||||
line-height: 1.6;
|
||||
}
|
||||
.test-section {
|
||||
margin: 2rem 0;
|
||||
padding: 1rem;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
}
|
||||
.test-link {
|
||||
display: inline-block;
|
||||
margin: 0.5rem 0;
|
||||
padding: 0.5rem 1rem;
|
||||
background: #007bff;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.test-link:hover {
|
||||
background: #0056b3;
|
||||
}
|
||||
code {
|
||||
background: #f5f5f5;
|
||||
padding: 0.2rem 0.4rem;
|
||||
border-radius: 3px;
|
||||
}
|
||||
pre {
|
||||
background: #f5f5f5;
|
||||
padding: 1rem;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Strapi Preview Implementation Test</h1>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>1. Test Preview Route (Valid Secret)</h2>
|
||||
<p>This should redirect to the homepage with preview parameters:</p>
|
||||
<a href="/preview?secret=preview-secret-key-change-this-in-production&path=/&status=draft" class="test-link">
|
||||
Test Valid Preview
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>2. Test Preview Route (Invalid Secret)</h2>
|
||||
<p>This should show an unauthorized page:</p>
|
||||
<a href="/preview?secret=wrong-secret&path=/&status=draft" class="test-link">
|
||||
Test Invalid Preview
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>3. Test Preview Mode Directly</h2>
|
||||
<p>This should show the homepage with preview banner:</p>
|
||||
<a href="/?preview=true&status=draft" class="test-link">
|
||||
Test Preview Mode
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>4. Test Article Preview (if you have articles)</h2>
|
||||
<p>This should test dynamic route preview:</p>
|
||||
<a href="/preview?secret=preview-secret-key-change-this-in-production&path=/articles/test-article&status=draft&documentId=123&uid=api::article.article" class="test-link">
|
||||
Test Article Preview
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>Expected Strapi Configuration</h2>
|
||||
<p>For reference, your Strapi config should generate URLs like this:</p>
|
||||
<pre><code>https://takerofnotes.com/preview?secret=preview-secret-key-change-this-in-production&path=/articles/my-article&status=draft&documentId=123&uid=api::article.article</code></pre>
|
||||
</div>
|
||||
|
||||
<div class="test-section">
|
||||
<h2>Environment Variables Check</h2>
|
||||
<p>Make sure these are set in your <code>.env</code> file:</p>
|
||||
<pre>VITE_CLIENT_URL=https://takerofnotes.com
|
||||
VITE_PREVIEW_SECRET=preview-secret-key-change-this-in-production</pre>
|
||||
|
||||
<p>And in your Strapi <code>.env</code> file:</p>
|
||||
<pre>CLIENT_URL=https://takerofnotes.com
|
||||
PREVIEW_SECRET=preview-secret-key-change-this-in-production</pre>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user