Developing Locally, Problem with Paths

#1

Hi everyone, im pretty new to hugo and static site generators and am trying to learn this new approach to developing static sites. Recently I have decided to migrate my drupal website to a static site. I want to use a static site generator with github. At first I tried jekyll, but had problems with getting javascript to work when I tried to implment a mega menu.

I put the project on hold a few months because I couldnt make it work. I then released that maybe I should try a different site generator. One that is designed for static page content as opposed to posts as main feature. Jekyll seems to be better for blogging. I like that Hugo is so simple to use and that everything is built based on the hierarchical structure of the content folder. I service computers, but also do web and ebook development. I want to create a site that opens to a gateway page that is about me and then have different sections for my services. This is why I want to use a mega menu.

On to the problem at hand. I was looking at https://www.staticgen.com/ and found hugo. I used netlify to auto deploy a instance of hugo and checked it out. Then I wanted to design a theme and test it out locally on my computer so I cloned the project onto my home ubuntu 17.10 desktop.

I started playing with it and thought Id might download a theme and see how it looks. So I cloned the theme into the theme directory under the site/theme root and specifed the theme in the config.toml file.

The problem is when I view the site using hugo server -D using the following config the site renders without the css. I checked the source and it does not seem to locate the paths correctly to render the css. I searched online to no avail to why I cant seem to get the pathing right. Right now the server is bound to 127.0.01 the url is http://localhost:1313. when I try to access any content from the content folder the path is not found and the theme im using wont render the css. I am assuming this has something to do with the path but everything looks right.

Can someone help me figure out where I am going wrong? I want to develop the site locally and then push my changes to github when I am ready. Is this possible? Thank you for your time.

baseurl = "/"
languageCode = "en-us"
languageLang = "en"
title = "My new Victor-Hugo site"

# RSS, categories and tags disabled for an easy start
# See configuration options for more details:
# https://gohugo.io/getting-started/configuration/#toml-configuration
disableKinds = ["RSS", "taxonomy", "taxonomyTerm"]
theme = "hugo-academic"
#2

The baseurl needs to be a FQDN, i.e. https:://example.com. The theme most likely uses the absURL function to link to the static files which puts the baseURL in front of the string you give it as argument. In your example, the resulting URL would probably be http:///$path_to_css which is wrong.

If this is not the source of the problem, please post more content of your site, for example the generated html code. It would be even better if you could host your code on github so we can check out your project and see what you did to find the error.

#3

We can’t troubleshoot without seeing the source for your site.Try setting the baseurl as @internetfreak suggested, but otherwise we need to see the site. Also, check out the post for requesting help for tips on getting assistance here. :slight_smile:

Also, it is always a good idea to check in with the theme author, as they will have more insight into their own code.

#4

Ok thank you for the responses. I dont know why the paths were not working, but I realized that the theme I was using has a deploy tool for netlify. I had cloned the theme from the github project into my deploy on netlify so maybe that was the problem. I created a new deploy for my site and deployed the theme using the automated netlify process and that seemed to fix the problem with the paths.