Skip to content

Commit

Permalink
feat: ignore the handling of http links
Browse files Browse the repository at this point in the history
  • Loading branch information
zouhangwithsweet committed Jul 1, 2021
1 parent bf2b971 commit 02ecd56
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/client/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function joinPath(base: string, path: string): string {
}

export function withBase(path: string) {
if (/^(https?:)?\/\//.test(path)) return path
return joinPath(siteDataRef.value.base, path)
}

Expand Down
3 changes: 1 addition & 2 deletions src/client/theme-default/components/HomeHero.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ const showHero = computed(() => {
})
const heroText = computed(() => frontmatter.value.heroText || site.value.title)
const isWebResource = (path: string) => /^(https{0,1}\:){0,1}\/\//.test(path)
</script>

<template>
<header v-if="showHero" class="home-hero">
<figure v-if="frontmatter.heroImage" class="figure">
<img
class="image"
:src="isWebResource(frontmatter.heroImage) ? frontmatter.heroImage : withBase(frontmatter.heroImage)"
:src="withBase(frontmatter.heroImage)"
:alt="frontmatter.heroAlt"
/>
</figure>
Expand Down

0 comments on commit 02ecd56

Please sign in to comment.