Skip to content

Commit

Permalink
Add story summary page for custom Google Search Index.
Browse files Browse the repository at this point in the history
  • Loading branch information
edwh committed Dec 28, 2023
1 parent 1bb6fb0 commit 81a0c09
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions pages/stories/summary.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
<h1>Stories from Freeglers</h1>
<p>This page lets you search through stories.</p>
</div>
<div class="gcse-search"></div>
<client-only>
<div class="gcse-search"></div>
</client-only>
<ul class="list-unstyled">
<li v-for="story in stories" :key="'story-' + story" class="mt-2">
<nuxt-link :to="'/story/' + story">{{story}}</nuxt-link>
<nuxt-link :to="'/story/' + story">{{ story }}</nuxt-link>
</li>
</ul>
</b-col>
Expand Down Expand Up @@ -46,8 +48,13 @@ const stories = computed(() => {
})
onMounted(() => {
let scr = document.createElement('script')
scr.setAttribute('src', 'https://cse.google.com/cse.js?cx=424a23761185040ff')
window.document.head.appendChild(scr)
if (process.client) {
const scr = document.createElement('script')
scr.setAttribute(
'src',
'https://cse.google.com/cse.js?cx=424a23761185040ff'
)
window.document.head.appendChild(scr)
}
})
</script>

0 comments on commit 81a0c09

Please sign in to comment.