Closed kanata2 closed 7 years ago
sorry, i have solved the problem... 😢
I thought going well if you set //example.github.io/
(remove protocol) as baseurl
, but it was useless... (https://github.com/spf13/hugo/issues/2085#issuecomment-210615051)
I want to ask you what I should do in the case.
I think the solution is to add support for schema-less baseURLs, if not already working, as you hint at.
Thank you for your comment (and changing the title to a more appropriate one).
It would be nice if you can be more clear about what doesn't work when using a schemaless baseURL?
Do you need a real baseURL
in you content? Relative paths from the root will be enough for src attributes. For example, baseURL = "/"
works fine for me on https://username.github.io/
as well as http://localhost/
.
I'm hosting a page with hugo on my own domain and I'm using a schema-less base URL. In general, this works just fine. However, when I try to preview the generated page through a $ hugo server
, I end up with a 404. Having a baseURL='//domain.tld/'
leads to the following local access URL: http://localhost:1313//domain.tld/
. Removing the "extra" slash doesn't seem to help.
I hope this is appropriate to add to this ticket but this is a bug that hugo itself seems to have with schema-less URLs.
when I try to preview the generated page through a
$ hugo server
, I end up with a 404. Having abaseURL='//domain.tld/'
leads to the following local access URL: http://localhost:1313//domain.tld/.
I also didn't go well because of the above reason. However, in the case of GitHub Pages, I also feel one of the solutions is the way that @heavywatal wrote.
Another issue is if you have your blog hosted on multiple domains (mirrored). Using baseUrl, any mirror pulling from a central git repo will have the same baseUrl which would be a problem.
Is there any way to just have hugo not write the base href header?
I too quite miss why baseUrl is needed at all... seems there are A LOT of issues based on this concept.
This issue has been automatically marked as stale because it has not been commented on for at least four months.
The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master
branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still valuable, please open a proposal at https://discuss.gohugo.io/.
This issue will automatically be closed in four months if no further activity occurs. Thank you for all your contributions.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Hello, There is a point which was worrisome when using the Hugo to GitHub pages. I want to ask you what I should do in the following cases.
For example
Now, GitHub pages support https. you can access
http://example.github.io
andhttps://example.github.io
by default when user name of GitHub isexample
. At this time, if you set one (http or https) asbaseurl
in config.toml and describe like<script src="{{ .Site.BaseURL }}path/to/example.js"></script>
in HTML , it will not load some files when user access GitHub pages in the other protocol. (Seemingly, many hugo's themes use BaseURL in src attribute of script (, link, img, etc) tag)I believe that we should dispense with a protocol in the src attribute. recommend:
src="//path/to/example.js"
not recommend:src="http://path/to/example.js"
Solutions
I came up with two solutions.
BaseURL
Please tell me if there is already suggested solutions.