-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
1,041 additions
and
386 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ node_modules | |
.DS_Store | ||
dist | ||
dist-ssr | ||
*.local | ||
*.local | ||
stats.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Build stage | ||
FROM node:lts-alpine as build-stage | ||
WORKDIR /app | ||
# Install before copying the rest, for caching purposes | ||
COPY package.json yarn.lock .yarnrc.yml ./ | ||
COPY .yarn/releases .yarn/releases | ||
RUN yarn install | ||
COPY . . | ||
RUN yarn run build | ||
|
||
# Production stage | ||
FROM nginx:stable-alpine as production-stage | ||
COPY --from=build-stage /app/dist /usr/share/nginx/html | ||
COPY nginx.conf /etc/nginx/conf.d/default.conf | ||
EXPOSE 80 | ||
# Make Nginx run in foreground | ||
RUN echo "daemon off;" >> /etc/nginx/nginx.conf | ||
CMD nginx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<html lang="sv"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" href="/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Queerlit</title> | ||
</head> | ||
<body class="h-full flex flex-col"> | ||
<div id="app" class="flex-1 flex flex-col"></div> | ||
<div id="app" class="flex-1 flex"></div> | ||
<script type="module" src="/src/main.ts"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
listen 80; | ||
server_name localhost; | ||
|
||
location / { | ||
root /usr/share/nginx/html; | ||
try_files $uri $uri/ /index.html; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { useRouter, useRoute } from "vue-router"; | ||
import { useHead } from "@unhead/vue"; | ||
import { pathUrl, slugify, urlBasename } from "./util"; | ||
import type { Term, Work } from "./types/work"; | ||
|
||
type RouteParams = { | ||
slug?: string; | ||
[k: string]: any; | ||
}; | ||
|
||
export function useCanonicalPath() { | ||
const route = useRoute(); | ||
const router = useRouter(); | ||
const head = useHead({}); | ||
|
||
/** Get the preferred path for a route */ | ||
function getCanonicalPath(name: string, params: RouteParams) { | ||
// Magically slugify any param named "slug" | ||
if (params.slug) params.slug = slugify(params.slug); | ||
// Get the route and its path | ||
const matchedRoute = router.resolve({ name, params }); | ||
return matchedRoute.path; | ||
} | ||
|
||
/** Get the preferred path for a Libris work page */ | ||
function getWorkPath(work: Work) { | ||
return getCanonicalPath("Work", { id: work.id, slug: work.title }); | ||
} | ||
|
||
/** Get the preferred path for a QLIT term page */ | ||
function getTermPath(term: Term) { | ||
// A QLIT term from Libris doesn't have the "name" prop, but it can be read from the uri | ||
const name = "name" in term ? term.name : urlBasename(term.id); | ||
return getCanonicalPath("Term", { id: name, slug: term.label }); | ||
} | ||
|
||
/** Replace current path if needed */ | ||
function ensurePath(path: string) { | ||
// Add canonical link | ||
head?.patch({ link: [{ rel: "canonical", href: pathUrl(path) }] }); | ||
// Modify current url | ||
if (route.path != path) { | ||
window.history.replaceState(window.history.state, "", path); | ||
} | ||
} | ||
|
||
return { | ||
getCanonicalPath, | ||
getWorkPath, | ||
getTermPath, | ||
ensurePath, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.