33 lines
706 B
Svelte
33 lines
706 B
Svelte
|
<h1>__PROJECT_TITLE__</h1>
|
||
|
|
||
|
<style lang="less">
|
||
|
h1 {
|
||
|
color: red;
|
||
|
}
|
||
|
</style>
|
||
|
|
||
|
<script lang="typescript">
|
||
|
import { scrollToTop } from "svelte-scrollto"
|
||
|
import { location } from "../store"
|
||
|
|
||
|
export let url = ""
|
||
|
if (url) {
|
||
|
// ssr
|
||
|
let l = url.split("?")
|
||
|
$location = {
|
||
|
path: l[0],
|
||
|
search: l.length > 1 ? l[1] : "",
|
||
|
categoryPath: l[0].replace(/\/\d{4,99}[^\/]+$/, ""),
|
||
|
push: false,
|
||
|
pop: false,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// scroll to top on new site
|
||
|
location.subscribe((l) => {
|
||
|
if (l.push) scrollToTop()
|
||
|
})
|
||
|
|
||
|
if (typeof window !== "undefined") console.log("App initialized")
|
||
|
</script>
|