Question

Deploy app with Hugo site in a subdirectory

When deploying a Hugo site as a DigitalOcean app, is there a way to get it working if the hugo site is not at the root of the repository? I have a “site” directory with the hugo site along with other directories at the root.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @hdlopes, this option is currently supported by the app specification, but not the web control panel so you will need to make this change using either doctl or the API.

On your hugo component, set the source_dir option to the name of the subdirectory that your Hugo site lives in. It will then be used as the working directory for the build.

For example:

...
static_sites:
  - name: hugo
    source_dir: website
    ...

See the App Specification reference.

To make this change using doctl, follow these steps:

  1. Install doctl
  2. List your apps and find your app’s UUID: doctl apps list
  3. Save your app’s spec to a file: doctl apps spec get APP-UUID > app.yaml
  4. Open app.yaml in a text editor and add the source_dir property.
  5. Update your app with the new spec: doctl apps update --spec app.yaml APP-UUID. This will kick off a new deployment

This comment has been deleted