基于雨果的网站

时间:2018-10-06 05:58:22

标签: gitlab hugo static-site

我有一个基于hugo主题的网站,我从gitlab托管在myusername.gitlab.io,然后我还有另一个基于hugo主题的小型网站,位于myusername.gitlab.io/repoA,我想从中添加我以前的网站,网址为myusername.gitlab.io/repoA

现在,这是我的问题(我还没有做很多事情,所以请原谅我的无知。)

  1. 我做一个URL,比如 username.gitlab.io/secondwebUrl吗? (我仍然需要做自定义域,生成新证书并将其添加到gitlab吗?)
  2. 我会更容易吗 创建一个子域(为了澄清,我正在使用Google托管 域和SSL(通过cloudflare))?

1 个答案:

答案 0 :(得分:4)

分析主题的构建输出

您必须分析您的单个主题产生的输出文件。例如:

Theme A produces:
   -- index_1.html
   -- style_1.css
Theme B produces:
   -- index_2.html
   -- style_2.css

编写一个简单的脚本

Hugo不支持运行后脚本,因此将两个站点相互堆叠的最简单方法是编写一个小的Shell脚本,例如:

 cd /path/to/themeA
 hugo themeA --destination=/deploy/location/

 cd /path/to/themeB
 hugo themeB --destination=/deploy/location/about/

这将导致布局如下:

 /deploy/location
    -- index_1.html
    -- style_1.html
    -- about/
       -- index_1.html
       -- index_2.html

此结果目录可以通过任何必须使用的方法部署到您的主机。

修复可能损坏的链接

现在,您只需查看结果页面,即可轻松识别损坏的链接,并在本地 hugo 模板的html中对其进行更改。

请勿使用子域

为此无需使用子域。证书仅适用于新的(子)域。