Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Src directory structure #1187

Closed
WebShapedBiz opened this issue May 15, 2020 · 8 comments
Closed

Src directory structure #1187

WebShapedBiz opened this issue May 15, 2020 · 8 comments

Comments

@WebShapedBiz
Copy link

Hi.
I'm making a site where users will handle several types of content (news, testimonials, seminars and authors) using NetlifyCMS.
Since I like things to look neat I was trying to put all the user-generated content in one directory called entries and each entry type as a separate folder inside entries like this:

src
|-- entries
|    |-- testimonials 
|    |    |-- testimonial-1.md
|    |    |-- testimonial-2.md
|    +-- news
|         |-- news-post-1.md
|         |-- news-post-2.md
...

Unfortunately, 11ty didn't pick up any of my templates until I moved everything inside the src folder like this:

src
|-- testimonials 
|    |-- testimonial-1.md
|    |-- testimonial-2.md
+-- news
     |-- news-post-1.md
     |-- news-post-2.md
...

Have I configured something wrong or 11ty cannot look inside more than 1 level deep directories inside src folder?

Cheers.

@WebShapedBiz WebShapedBiz changed the title Scr directory structure Src directory structure May 15, 2020
@pdehaan
Copy link
Contributor

pdehaan commented May 15, 2020

I have very deeply nested folders, depending on the project.

  • What was your terminal output?
  • Which version of 11ty (0.10, or 0.11)?

@WebShapedBiz
Copy link
Author

Thank you @pdehaan for your time and effort.
There are no errors in the terminal, just when you look at the list of all things picked up and being written in _site directory, there are no files from the entries folder.
I'm still using 11ty v0.10

Cheers.

@pdehaan
Copy link
Contributor

pdehaan commented May 15, 2020

https://github.com/pdehaan/11ty-1187

npm run build

> 11ty-1187@1.0.0 build /Volumes/Dev/github/pdehaan/tmp/11ty-1187
> eleventy

Writing www/entries/testimonials/testimonial-2/index.html from ./src/entries/testimonials/testimonial-2.md.
Writing www/entries/testimonials/testimonial-1/index.html from ./src/entries/testimonials/testimonial-1.md.
Writing www/entries/news/news-post-1/index.html from ./src/entries/news/news-post-1.md.
Writing www/entries/news/news-post-2/index.html from ./src/entries/news/news-post-2.md.
Wrote 4 files in 0.14 seconds (v0.11.0)
tree
.
├── package-lock.json
├── package.json
├── src
│   └── entries
│       ├── news
│       │   ├── news-post-1.md
│       │   └── news-post-2.md
│       └── testimonials
│           ├── testimonial-1.md
│           └── testimonial-2.md
└── www
    └── entries
        ├── news
        │   ├── news-post-1
        │   │   └── index.html
        │   └── news-post-2
        │       └── index.html
        └── testimonials
            ├── testimonial-1
            │   └── index.html
            └── testimonial-2
                └── index.html

12 directories, 10 files

@WebShapedBiz
Copy link
Author

This looks exactly as my output except for no "Writing" lines :-)

@pdehaan
Copy link
Contributor

pdehaan commented May 15, 2020

@WebShapedBiz Is the repo public somewhere? I can try cloning and building locally and see if I get the same results. Curious if it's something in your .eleventy.js config file, or maybe an OS issue (I'm on macOS).

@pdehaan
Copy link
Contributor

pdehaan commented May 15, 2020

Oh, do you have any other pages on the site, and are they building?

@WebShapedBiz
Copy link
Author

Yes, I do have 6 other pages and they are building without issue.
The repo is, unfortunately, private because of my client's credentials for Cloudinary (NetlifyCMS plugin) and TalentLMS (API for working with lessons).
The .eleventy.js has a default setup regarding folders:

return {
        dir: {
            input: "src",
            output: "_site"
        }
    };

Folder structure, like almost always, was created from within VSCode (elementaryOS Linux) so no folder permission issues there.
Since I wasn't sure that this is not intentional, I've never seriously dug for an answer. Now that I know this folder structure should work, I'll try to investigate it further.

Again, thank you @pdehaan for your time and effort.

@pdehaan
Copy link
Contributor

pdehaan commented May 15, 2020

Yeah, that's very odd. I can't think of what else it would be. You could blindly just try adding some "index.njk" or "index.md" files in your tree structure and see if that makes a difference. Although I can't really imagine where something would choke on a directory with only subdirectories and not a directly nested file (and it works for me currently on macOS 10.15.4 w/ eleventy 0.11.0):

src
|-- entries
|    |-- index.md
|    |-- testimonials
|    |    |-- index.md 
|    |    |-- testimonial-1.md
|    |    |-- testimonial-2.md
|    +-- news
|         |-- news-post-1.md
|         |-- news-post-2.md
...

Good luck, and let us know if you get it solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants