Knaito163 8 лет назад
Родитель
Сommit
27675bd70a
2 измененных файлов с 17 добавлено и 3 удалено
  1. 8 0
      lib/util/swigFunctions.js
  2. 9 3
      lib/views/admin/customize.html

+ 8 - 0
lib/util/swigFunctions.js

@@ -97,6 +97,14 @@ module.exports = function(crowi, app, req, locals) {
     return Config.customHeader(config);
     return Config.customHeader(config);
   }
   }
 
 
+  locals.customTitle = function() {
+    var config = crowi.getConfig();
+    var title = Config.customTitle(config);
+    var app_title = config.crowi['app:title'] ? config.crowi['app:title'] : 'Crowi';
+    var custom_title = title.replace('{{sitename}}', app_title);
+    return custom_title;
+  }
+
   locals.behaviorType = function() {
   locals.behaviorType = function() {
     var config = crowi.getConfig()
     var config = crowi.getConfig()
     return Config.behaviorType(config);
     return Config.behaviorType(config);

+ 9 - 3
lib/views/admin/customize.html

@@ -301,15 +301,21 @@ export  $initHighlight;</code></pre>
 
 
       <form action="/_api/admin/customize/title" method="post" class="form-horizontal" id="customtitleSettingForm" role="form">
       <form action="/_api/admin/customize/title" method="post" class="form-horizontal" id="customtitleSettingForm" role="form">
         <fieldset>
         <fieldset>
-          <legend>カスタムヘッダータイトルHTML</legend>
+          <legend>カスタムヘッダーTitle</legend>
 
 
           <p class="well">
           <p class="well">
-            &lt;title&gt;タグのコンテンツをカスタムできる。具体的にはユーザ、ページタイトル、サイト名の3つの順番入れ替えや表示・非表示がカスタマイズできる。<br>
+            ヘッダーの&lt;title&gt;タグのコンテンツをカスタムできる。サイト名を入れたい位置に、&#123;&#123;sitename&#125;&#125;
+            パスを入れたい位置に&#123;&#123;path&#125;&#125;を置くことでそれぞれの値に自動置換されます。それ以外の部分は自由に記述して下さい。<br>
           </p>
           </p>
 
 
           <p class="help-block">
           <p class="help-block">
             Examples:
             Examples:
-            <pre><code>\{% block html_title %}{% endblock %} {{ config.crowi['app:title']|default('Crowi') }}\</code></pre>
+            <pre><code>&#123;&#123;sitename&#125;&#125; hoge - &#123;&#123;path&#125;&#125;</code></pre>
+          </p>
+
+          <p class="help-block">
+            Output:
+            <pre><code>&lt;title&gt;GROWI hoge - /xxx/yyy/zzz/Sandbox&lt;&#047;title&gt;</code></pre>
           </p>
           </p>
 
 
           <div class="form-group">
           <div class="form-group">