Skip to content

Commit 778a156

Browse files
committed
fix: Extract and use hostname variable.
1 parent bb4bbfd commit 778a156

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/lib/bibtex.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
<script lang="ts">
22
import type { Paper, Venue } from './app-types';
3+
import { hostname } from './hostname';
34
export let paper: Paper;
45
export let venue: Venue;
56
6-
const HOST_URL = 'https://uwdata.github.io';
7-
87
function formatBibtex(p: Paper, v: Venue) {
98
const venue = v.venueType == 'journal' ? 'journal' : 'booktitle';
109
const edits = (p.editors || '').replace('&', 'AND');
@@ -25,7 +24,7 @@
2524
attr('pages', pages),
2625
attr('publisher', p.publisher),
2726
attr('location', p.location),
28-
attr('url', `${HOST_URL}/papers/${p.web_name}`),
27+
attr('url', `${hostname}/papers/${p.web_name}`),
2928
attr('doi', p.doi)
3029
];
3130

src/lib/hostname.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const hostname = 'https://uwdata.github.io';

src/routes/papers/[slug]/+page.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import Bibtex from '$lib/bibtex.svelte';
55
import Materials from '$lib/materials.svelte';
66
import { displayName } from '$lib/display-name';
7-
import { base } from '$app/paths';
7+
import { hostname } from '$lib/hostname';
88
export let data: { paper: Paper; venue: Venue };
99
$: paper = data.paper;
1010
$: venue = data.venue;
@@ -17,8 +17,8 @@
1717
<meta name="twitter:card" content="summary" />
1818
<meta name="twitter:site" content="@uwdata" />
1919
<meta property="twitter:title" content={paper.title} />
20-
<meta property="og:image" content={`${base}/${paper.thumbnail}`} />
21-
<meta property="twitter:image" content={`${base}/${paper.thumbnail}`} />
20+
<meta property="og:image" content={`${hostname}/${paper.thumbnail}`} />
21+
<meta property="twitter:image" content={`${hostname}/${paper.thumbnail}`} />
2222
{#if paper.doi}<meta name="citation_doi" content={paper.doi} />{/if}
2323
<meta name="citation_title" content={paper.title} />
2424
<meta name="citation_{venue.venueType === 'journal' ? 'journal' : 'inbook'}_title" content={venue.fullName} />

0 commit comments

Comments
 (0)