aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-11-04 17:37:44 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-11-04 17:37:44 +0100
commit3ec343a41da8ada8efaf8e697057b35abdd787b5 (patch)
tree1bf385dd6ddfa199a5079d8664d984c89ae9b7a1 /client/src/app
parentb58c69a1edcf63b6339576b5b431dbf7dea2c625 (diff)
downloadPeerTube-3ec343a41da8ada8efaf8e697057b35abdd787b5.tar.gz
PeerTube-3ec343a41da8ada8efaf8e697057b35abdd787b5.tar.zst
PeerTube-3ec343a41da8ada8efaf8e697057b35abdd787b5.zip
Client: add opengraph tags
Diffstat (limited to 'client/src/app')
-rw-r--r--client/src/app/videos/video-watch/video-watch.component.ts22
1 files changed, 22 insertions, 0 deletions
diff --git a/client/src/app/videos/video-watch/video-watch.component.ts b/client/src/app/videos/video-watch/video-watch.component.ts
index 736ca7d5a..e705fa555 100644
--- a/client/src/app/videos/video-watch/video-watch.component.ts
+++ b/client/src/app/videos/video-watch/video-watch.component.ts
@@ -2,6 +2,7 @@ import { Component, ElementRef, NgZone, OnDestroy, OnInit, ViewChild } from '@an
2import { ActivatedRoute } from '@angular/router'; 2import { ActivatedRoute } from '@angular/router';
3 3
4import { ModalDirective } from 'ng2-bootstrap/components/modal'; 4import { ModalDirective } from 'ng2-bootstrap/components/modal';
5import { MetaService } from 'ng2-meta';
5 6
6import { Video, VideoService } from '../shared'; 7import { Video, VideoService } from '../shared';
7import { WebTorrentService } from './webtorrent.service'; 8import { WebTorrentService } from './webtorrent.service';
@@ -33,6 +34,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
33 private ngZone: NgZone, 34 private ngZone: NgZone,
34 private route: ActivatedRoute, 35 private route: ActivatedRoute,
35 private videoService: VideoService, 36 private videoService: VideoService,
37 private metaService: MetaService,
36 private webTorrentService: WebTorrentService 38 private webTorrentService: WebTorrentService
37 ) {} 39 ) {}
38 40
@@ -42,6 +44,7 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
42 this.videoService.getVideo(id).subscribe( 44 this.videoService.getVideo(id).subscribe(
43 video => { 45 video => {
44 this.video = video; 46 this.video = video;
47 this.setOpenGraphTags();
45 this.loadVideo(); 48 this.loadVideo();
46 }, 49 },
47 error => alert(error.text) 50 error => alert(error.text)
@@ -104,6 +107,25 @@ export class VideoWatchComponent implements OnInit, OnDestroy {
104 console.error('The video load seems to be abnormally long.'); 107 console.error('The video load seems to be abnormally long.');
105 } 108 }
106 109
110 private setOpenGraphTags() {
111 this.metaService.setTag('og:type', 'video');
112
113 this.metaService.setTag('og:title', this.video.name);
114 this.metaService.setTag('name', this.video.name);
115
116 this.metaService.setTag('og:description', this.video.description);
117 this.metaService.setTag('description', this.video.description);
118
119 this.metaService.setTag('og:image', this.video.thumbnailPath);
120
121 this.metaService.setTag('og:duration', this.video.duration);
122
123 this.metaService.setTag('og:site_name', 'PeerTube');
124
125 this.metaService.setTag('og:url', window.location.href);
126 this.metaService.setTag('url', window.location.href);
127 }
128
107 private runInProgress(torrent: any) { 129 private runInProgress(torrent: any) {
108 // Refresh each second 130 // Refresh each second
109 this.torrentInfosInterval = setInterval(() => { 131 this.torrentInfosInterval = setInterval(() => {