Skip to content

Commit

Permalink
fix: redirect on server
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Apr 1, 2024
1 parent 1954ab5 commit a725fa0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
12 changes: 6 additions & 6 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,29 @@ export default defineNuxtConfig({
* @see https://nuxt.com/docs/guide/concepts/rendering#route-rules
*/
routeRules: {

// TODO: prerender / but not if there are query params
'/': {},

'/posts/**': {
swr: 60 * 5
},

// Static pages are prerendered
'/': {prerender: true},
'/other-sites': {prerender: true},
'/legal': {prerender: true},

'/settings': {ssr: false},

// TODO: Remove when A/B testing is finished @see 040.matomo.client.ts
'/premium': {ssr: false},
// '/premium': {prerender: true},
'/premium': {prerender: true},
'/premium/sign-in': {prerender: true},

// All premium pages are client-side rendered
'/premium/dashboard': {ssr: false},
'/premium/saved-posts/*': {ssr: false},
'/premium/saved-posts': {ssr: false},
'/premium/tag-collections': {ssr: false},
'/premium/additional-boorus': {ssr: false},
'/premium/backup': {ssr: false},
'/premium/migrate-old-data': {ssr: false},

// Public assets
'/img/**': {
Expand Down
8 changes: 2 additions & 6 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,6 @@ definePageMeta({
* Redirect to /posts/<domain> if query parameters [domain, page, tags] are set.
*/
function (to, from) {
if (process.server) {
return
}
if (!to) {
return
}
Expand All @@ -120,7 +116,7 @@ definePageMeta({
searchParams.delete('domain')
// Redirect
window.location.replace('/posts/' + to.query.domain + '?' + searchParams.toString())
return navigateTo('/posts/' + to.query.domain + '?' + searchParams.toString())
}
]
})
Expand Down Expand Up @@ -545,7 +541,7 @@ const featuredDomains = [
</span>
</NuxtLink>

<!-- <span class="ml-auto block text-xs">Scroll →</span>-->
<!-- <span class="ml-auto block text-xs">Scroll →</span>-->
</div>

<FeaturedTags
Expand Down

0 comments on commit a725fa0

Please sign in to comment.