Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: APPS-2903 Create a redirect for staff subject librarian #862

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion netlify.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[[edge_functions]]
path = "/*"
function = "blockUserAgents"
function = "blockUserAgents"

[[edge_functions]]
path = "/about/staff"
function = "redirect"
20 changes: 20 additions & 0 deletions netlify/edge-functions/redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default async (request, context) => {
const url = await new URL(request.url)
const params = await url.searchParams
const filters = await params.get('filters')

if (filters && filters === '{"subjectLibrarian.keyword":"yes"}') {
// Modify the query parameters
params.set('filters', 'subjectLibrarian.keyword:(yes)')

// Redirect to the new URL with the updated parameters
return new Response(null, {
status: 302,
headers: {
Location: `${url.pathname}?${params.toString()}`
}
})
}

return context.next()
}
1 change: 1 addition & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ export default defineNuxtConfig({

routeRules: {
'/impact/all': { redirect: '/about/reports' },
'/about/staff/?q=&filters={%22subjectLibrarian.keyword%22:%22yes%22}': { redirect: '/about/staff/?q=&filters=subjectLibrarian.keyword:(yes)' },
},

/*
Expand Down
1 change: 1 addition & 0 deletions public/_redirects
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
/about/programs/library-special-collections-lsc-research-fellowships-2023 /about/programs/library-special-collections-lsc-research-fellowships
/about/staff/chen-gao-%E9%AB%98%E6%99%A8 /about/staff/chen-gao/
/about/staff/hui-li-%E6%9D%8E%E6%85%A7 /about/staff/hui-li/
/about/staff/?q=&filters={"subjectLibrarian.keyword":"yes"} /about/staff/?q=&filters=subjectLibrarian.keyword:(yes)
/about/student-positions /about/student-opportunities
/about/policies/report-problematic-content-and-description-in-uclas-library-collections-and-archives https://ucla.libwizard.com/id/38f45c482a5fcb0b715a7e9e3ddee8b2
/access-privileges/library-cards /help/services-resources/library-cards
Expand Down
Loading