diff --git a/youtube/html_common.py b/youtube/html_common.py
index 8e65a1f..b8ea0d6 100644
--- a/youtube/html_common.py
+++ b/youtube/html_common.py
@@ -104,115 +104,6 @@ medium_channel_item_template = Template('''
-
-header_template = Template('''
-
-''')
-playlist_option_template = Template('''''')
-def get_header(search_box_value=""):
- playlists = ''
- for name in local_playlist.get_playlist_names():
- playlists += playlist_option_template.substitute(name = name)
- return header_template.substitute(playlists = playlists, search_box_value = html.escape(search_box_value))
-
-
-
-
-
-
-
-
-
-
-
def badges_html(badges):
return ' | '.join(map(html.escape, badges))
diff --git a/youtube/templates/base.html b/youtube/templates/base.html
new file mode 100644
index 0000000..e98f972
--- /dev/null
+++ b/youtube/templates/base.html
@@ -0,0 +1,111 @@
+
+
+
+
+ {% block page_title %}{% endblock %}
+
+
+
+
+
+
+
+
+
+{% block main %}
+{% endblock %}
+
+
+
diff --git a/youtube/templates/error.html b/youtube/templates/error.html
index f253807..1f33c44 100644
--- a/youtube/templates/error.html
+++ b/youtube/templates/error.html
@@ -1,17 +1,8 @@
-
-
-
-
- Error
-
-
-
-
-
-
-{{ header|safe }}
-
-{{ error_message }}
-
-
-
+{% extends "base.html" %}
+
+{% block page_title %}Error{% endblock %}
+
+{% block main %}
+ {{ error_message }}
+{% endblock %}
+
diff --git a/youtube/templates/watch.html b/youtube/templates/watch.html
index 7e83306..f00413d 100644
--- a/youtube/templates/watch.html
+++ b/youtube/templates/watch.html
@@ -1,13 +1,6 @@
-
-
-
-
- {{ title }}
-
-
-
-
-
-
-
-{{ header|safe }}
-
+{% endblock style %}
+
+{% block main %}
@@ -212,11 +203,4 @@
{{ related|safe }}
-
-
-
-
-
-
-
-
+{% endblock main %}
diff --git a/youtube/watch.py b/youtube/watch.py
index 48fd7e3..72268a7 100644
--- a/youtube/watch.py
+++ b/youtube/watch.py
@@ -1,5 +1,5 @@
from youtube import yt_app
-from youtube import util, html_common, comments
+from youtube import util, html_common, comments, local_playlist
import settings
from flask import request
@@ -214,9 +214,8 @@ def get_watch_page():
'note': yt_dl_downloader._format_note(format),
})
-
return flask.render_template('watch.html',
- header = html_common.get_header(),
+ header_playlist_names = local_playlist.get_playlist_names(),
uploader_channel_url = '/' + info['uploader_url'],
upload_date = upload_date,
views = (lambda x: '{:,}'.format(x) if x is not None else "")(info.get("view_count", None)),