razonyang / hugo-theme-bootstrap

A fast, responsive, multipurpose and feature-rich Hugo theme.
https://hbs.razonyang.com
MIT License
508 stars 166 forks source link

Deployment question #112

Closed jehoshua7 closed 3 years ago

jehoshua7 commented 3 years ago

I have installed the theme as per the instructions at https://github.com/razonyang/hugo-theme-bootstrap , and then run it locally as http://localhost:1313/en/ , and it all runs okay.

I have been able to deploy other themes and run them on a website, however I'm not able to deploy the 'hugo-theme-bootstrap' theme successfully.

Some questions please:

  1. What does this command do and why is it necessary ? cp -a themes/hugo-theme-bootstrap/exampleSite/* .
  2. With other themes I have noticed the configuration file is in /mysite/themes/themename/exampleSite/config.toml , yet in this theme there are two files bearing that name, one ~/Hugo/mysite/themes/hugo-theme-bootstrap/exampleSite/config/production/config.toml and the other one at ~/Hugo/mysite/themes/hugo-theme-bootstrap/exampleSite/config/production/_default/config.toml . Under the configuration options shown at https://github.com/razonyang/hugo-theme-bootstrap, I have tried modifying the "baseURL" , then deploy and upload to a site, yet the theme CSS seems missing and links do not show correctly.
    Obviously I am doing something wrong with the deploy ?? It is simply ~/Hugo/mysite/themes/hugo-theme-bootstrap/exampleSite$ hugo -D --themesDir ../..
razonyang commented 3 years ago

The cp command is not necessary. The installation section shows how to create a site from scratch. If you already have a site, all you have to do is that add a git submodule and then modify your configuration. git submodule add https://github.com/razonyang/hugo-theme-bootstrap themes/hugo-theme-bootstrap.

As the 2nd question, the example site uses a configuration directory instead of a single configuration file.

As the configuration path shows, _default means the default settings which will be merged into the target environment(production, development...).

Default environments are development with hugo server and production with hugo.

In order to modify baseURL, it depends on how do you configure your site:

jehoshua7 commented 3 years ago

@razonyang - Thanks for your replies. It is obvious the directory structure for this theme is slightly different to the other themes I am testing. The theme runs fine locally, although the other themes run locally are of the nature http://localhost:1313 , yet for this theme I have to use http://localhost:1313/hugo/hugo-theme-bootstrap/

Further testing of the deployment process still doesn't work for me. It seems to be simply related to the URL's and relative URL's.
I would post a link to the website I'm using for testing, however I do not want that picked up with search engines, etc. Possibly I can send you the link in a PM ?

Are there any specific instructions for deployment of this theme please ? Also, is there a single language (english) version of the theme please ? Thanks for your help.

razonyang commented 3 years ago

Applying this theme to an existing site(myblog):

Add a git submodule

cd myblog
git submodule add https://github.com/razonyang/hugo-theme-bootstrap themes/hugo-theme-bootstrap

Copy configuration

mkdir config
cp -a themes/hugo-theme-bootstrap/exampleSite/config/* ./config

Rename the single config file

mv config.toml config.toml.orig

This step prevents the single configuration file from conflicting with the configuration directory.

Btw, you can also generate a single configuration file(config.toml). Take params.toml as an example, copy and paste the content under the [params] table of config.toml.

baseURL = "http://example.org/"
title = "My Blog"

[params]
  # paste params.toml content here

[social]
  # paste social.toml content here

# ...

Additional steps

Remove other language's configurations.

rm config/_default/*.zh-*.toml

And then remove needless language items from languages.toml.

You can reach me via email.

jehoshua7 commented 3 years ago

@razonyang - Thanks for your reply, that is awesome. It now works fine on the website.

This step prevents the single configuration file from conflicting with the configuration directory.

That must have been what fixed it, thank you. I haven't dome the language modifications or the config file modifications yet, just wanted to get the theme going on the website. Thanks :)

jehoshua7 commented 3 years ago

You can reach me via email.

Thanks for your help. Have decided to use this theme on the website. Have emailed you.

razonyang commented 3 years ago

@jehoshua7 The pleasure is mine.

BTW, if you followed steps I mentioned above. There is an important step for turning on Archive and Search features:

Please copy the archives and search directory to the content directory.

jehoshua7 commented 3 years ago

I have sent you an email, as I did a re-installation, deploy and upload, and now it isn't working (404 msg). Obviously I have done something wrong with the config file/s ??

jehoshua7 commented 3 years ago

@razonyang - Thanks for your reply to my email, the website works again now. As per your instructions I had to modify /~/Hugo/mysite/themes/hugo-theme-bootstrap/exampleSite/config/production/config.toml