如何更改 GitLab <title>? [英] How do I change GitLab <title>?
问题描述
我找了又找没找到..我想更改页面标题
I've looked and looked and can't find it..I want to change the page title
<title>GitLab</title>
包含更多信息.我似乎找不到任何地方可以做到这一点,因为我已经搜索了 github 并且没有看到任何答案.
to include more information. I can't seem to find anywhere to do this as i've scoured github and don't see any answers.
推荐答案
当你考虑像 app/views/layouts/devise.html.haml
,你看:
When you consider a page like app/views/layouts/devise.html.haml
, you see:
!!! 5
%html{ lang: "en"}
= render "layouts/head" <=====
%body.ui_basic.login-page
= render "layouts/flash"
.container
.content
%center
%h1 GitLab
这意味着html结果的<head>
部分是由app/views/layouts/_head.html.haml
:
That means the <head>
part of the html result is generated by app/views/layouts/_head.html.haml
:
%head
%meta{charset: "utf-8"}
%title
= "#{title} | " if defined?(title)
GitLab
这就是 GitLab 的来源.
That is where that GitLab comes from.
正如本haml 参考文档 中所述,标题已修改用 @title
:
As explained in this haml reference document, the title is modified with @title
:
# file: app/controllers/movies_controller.rb
class MoviesController < ApplicationController
def index
@title = "Teen Wolf"
end
end
例如,GitLab 源 'app/controllers/users_controller.rb
' 修改标题.
For instance, the GitLab source 'app/controllers/users_controller.rb
' modifies the title.
但我看不出有任何方法可以将 default 标题作为参数,当控制器未定义标题时,该标题会被放入.
所以你可能不得不直接修改那个 _head.html.haml
文件.
But I don't see any way to put as a parameter the default title which is put when a controller doesn't define a title.
So you may have to modify directly that _head.html.haml
file.
这篇关于如何更改 GitLab <title>?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!