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.

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.

×
1 answer

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
Submit an Answer