diff --git a/index.html b/index.html
index a5f6477..45c990b 100644
--- a/index.html
+++ b/index.html
@@ -30,7 +30,7 @@
// essential settings
ditto.index = "README.md",
ditto.sidebar_file = "sidebar.md",
-
+ ditto.document_title = "ECMAScript 6入门",
// where the docs are actually stored on github - so you can edit
ditto.base_url = "https://github.com/ruanyf/es6tutorial/edit/gh-pages/"; // <------- EDIT ME!!
diff --git a/js/ditto.js b/js/ditto.js
index 133809e..6ca2f3b 100644
--- a/js/ditto.js
+++ b/js/ditto.js
@@ -186,18 +186,21 @@ function router() {
$.get(path , function(data) {
$(ditto.error_id).hide();
$(ditto.content_id).html(marked(data));
-
+ if ($(ditto.content_id h1) === ditto.document_title){
+ document.title = ditto.document_title;
+ } else {
+ document.title = $(ditto.content_id h1).text() + " - " + ditto.document_title;
+ }
normalize_paths();
create_page_anchors();
-
+ $('#content code').map(function() {
+ Prism.highlightElement(this);
+ });
}).fail(function() {
show_error();
}).always(function() {
clearInterval(loading);
- $('#content code').map(function() {
- Prism.highlightElement(this);
- });
$(ditto.loading_id).hide();
});
}