Accessing Data files from a module

My site imports a theme (seperate repo) as a module which is used by multiple other sites. I need to keep a Data file within this theme module so it is accessible to multiple sites, but Hugo seems to lose visibility of the Data folder if it’s located within the module.

Site structure:

- Main site
    - content
    - layouts
    - config.yml

- Theme repo/module
    - Data
        - navigation.yml

How I import the module for use:

    - "local/component-library -> ../../theme/component-library"
    - " -> ../../theme/"
    - path: "local/component-library"
    - path: ""
    - path: ""

How can I access the data file within my theme module?

My memory is a little hazy, but I suspect you need to mount it (either in the project’s or module’s config).

1 Like

Is the directory name “Data” or “data” ?

1 Like

@bep Thank you, that’s fixed it!

That was a typo sorry, it was supposed to be lowercase. Solved by mounting the data directory:

source = "data"
target = "data"
1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.