Skip to content

Commit

Permalink
fix: APPS-2505 (#755)
Browse files Browse the repository at this point in the history
* fix: Add redirect to libwizard

* fix: netlify redirects not working so using vue router extra package to redirect

* fix: could not use router extras redirect
  • Loading branch information
pghorpade authored Nov 17, 2023
1 parent bde4041 commit 72074b3
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 31 deletions.
3 changes: 0 additions & 3 deletions layouts/error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
An error occurred
</h1>

{{ error }}
</h3>

<p>
We can’t find the page you are looking for, but we're here to
help. <nuxt-link to="/">
Expand Down
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default {
esWriteKey: process.env.ES_WRITE_KEY,
},
publicRuntimeConfig: {
host: process.env.SITEMAP_HOST,
s3Bucket: process.env.S3_BUCKET,
esReadKey: process.env.ES_READ_KEY || "",
esIndex: process.env.ES_INDEX || "",
Expand Down
95 changes: 67 additions & 28 deletions pages/about/policies/_slug.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<template lang="html">
<main id="main" class="page page-general-content">
<main
id="main"
class="page page-general-content"
>
<nav-breadcrumb
to="/about/policies"
:title="page.title"
Expand Down Expand Up @@ -27,12 +30,15 @@
</section-wrapper>

<section-wrapper theme="divider">
<divider-way-finder class="divider-way-finder" color="about" />
<divider-way-finder
class="divider-way-finder"
color="about"
/>
</section-wrapper>

<page-anchor
v-if="h2Array.length >=3"
:section-titles= h2Array
v-if="h2Array.length >= 3"
:section-titles="h2Array"
/>

<!-- Rich Text is not showing up -->
Expand All @@ -43,7 +49,6 @@
/>
</main>
</template>

<script>
// HELPERS
import _get from "lodash/get"
Expand All @@ -53,22 +58,51 @@ import removeTags from "~/utils/removeTags"
import POLICY_DETAIL from "~/gql/queries/PolicyDetail"
export default {
async asyncData({ $graphql, params, store, $elasticsearchplugin, error }) {
async asyncData({
$graphql,
params,
$config,
$elasticsearchplugin,
error,
redirect,
route,
}) {
// Do not remove testing live preview
/*console.log(
console.log(
"fetching graphql data for Policy detail from Craft for live preview"
)*/
const data = await $graphql.default.request(POLICY_DETAIL, {
slug: params.slug,
})
if (!data.entry) {
error({ statusCode: 404, message: 'Page not found' })
}
if (data) await $elasticsearchplugin.index(data.entry, params.slug)
// //console.log("Data fetched: " + JSON.stringify(data))
)
if (
params.slug ===
"report-problematic-content-and-description-in-uclas-library-collections-and-archives"
) {
redirect(
"https://ucla.libwizard.com/id/38f45c482a5fcb0b715a7e9e3ddee8b2"
)
} else if (
params.slug ===
"toward-ethical-and-inclusive-descriptive-practices-in-ucla-library-special-collections"
) {
console.log(route)
redirect(`${$config.host}/about/policies/ethical-description`)
} else {
const data = await $graphql.default.request(POLICY_DETAIL, {
slug: params.slug,
})
console.log(data)
if (!data.entry) {
error({ statusCode: 404, message: "Page not found" })
}
if (data) await $elasticsearchplugin.index(data.entry, params.slug)
// //console.log("Data fetched: " + JSON.stringify(data))
return {
page: _get(data, "entry", {}),
}
}
},
data() {
return {
page: _get(data, "entry", {}),
h2Array: [], // anchor tags
}
},
head() {
Expand All @@ -79,22 +113,27 @@ export default {
title: title,
meta: [
{
hid: 'description',
name: 'description',
content: metaDescription
}
hid: "description",
name: "description",
content: metaDescription,
},
],
}
},
data() {
return {
h2Array: [] // anchor tags
}
},
mounted() {
console.log("In mounted client side")
// Call the plugin method to get the .section-header2 and .section-header3 elements
this.h2Array = this.$getHeaders.getHeadersMethod();
}
this.h2Array = this.$getHeaders.getHeadersMethod()
/*window.onNuxtReady(() => {
if (
this.$route.params.slug ===
"report-problematic-content-and-description-in-uclas-library-collections-and-archives"
)
window.$nuxt.$router.push(
"https://ucla.libwizard.com/id/38f45c482a5fcb0b715a7e9e3ddee8b2"
)
})*/
},
}
</script>

Expand Down

29 comments on commit 72074b3

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65579ad343850a08a5f137a5--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6557ca926713b81bb6670f52--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655873977e367c397cd75cf3--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65591beac88a0e2699494e97--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6559c5305b5dda06c9603ccf--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655a6d7c85bcee7288790a40--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655b16997e367c5a22d75d71--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655bbf4a503b491f4b7660fc--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655c6878b913a8549ce87376--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655d10cb01df1a00992f24cf--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655db9ea2a036274c9b1f129--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655e620a02aefc724c7b0308--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655f0b08036f1f5521c2eb76--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://655fb3be8eef9f331b7e8245--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65605ce456f2e018a666dcd4--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6561054ea9fd6e257de563ca--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6561ae2eea7b15031cf3cd60--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65625679af5aa36dbf98de77--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6562ffd39094614a15bbda4d--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6563a854e167cf2fea530308--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://656451a01fd77716a112ab45--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6564f9c4c8ac302286e63675--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6565a2fc98ee2742b9812f8e--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65664b188b880b13749e7d62--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6566f48813258f36b59fe442--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65679c96fe8d950d8e5ee20e--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://65684600862f7e334249aa19--uclalibrary.netlify.app

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸŽ‰ Published on https://www.library.ucla.edu as production
πŸš€ Deployed on https://6568ee6b2e05de04dfdda847--uclalibrary.netlify.app

Please sign in to comment.