diff --git a/ts/category.ts b/ts/category.ts index 2dfc975..146ab72 100644 --- a/ts/category.ts +++ b/ts/category.ts @@ -1,18 +1,21 @@ class VideoMeta { name: string|null thumbnail: string|null + category: string constructor(raw: any) { this.name = raw['name'] this.thumbnail = raw['thumbnail'] - } + let path = window.location.pathname + this.category = path.substring(path.lastIndexOf('/')+1) + } title_link() : HTMLHeadingElement { let container = document.createElement('h2') let link = document.createElement('a') if(this.name) { - link.href = `/clip/${this.name}` + link.href = `/clip/${this.category}/${this.name}` link.text = this.name.replace('.', ' ').replace('-', ' ') } else { link.href = '#'