Remove prefix «_» from posts dirrectory

HI.

I’m trying to solve the following problem.
In my project, there are posts in the _posts directory and they have the following structure.

├── _posts
    └── post_1
        └── 2023-08-27-post_1.md
        └── solution.go
        └── solution.spec.go
    └── post_2
        └── 2023-08-27-post_2.md
        └── solution.go
        └── solution.spec.go

In every post I include GO file with code to code block this way.

{% include_relative go/solution.go %}

It works fine but there is one problem. Go doesn’t work in directories which starts from _. Thats why I cannot init go modules and run tests for go file.

Actually, my question is whether it is possible to somehow force Jekyll to store posts, for example, in the posts directory?

not that I know of but I could be wrong. Posts and collections are always in a folder with an underscore.

If you don’t need the features you get from using a post you could just do them as pages. The main thing you get with posts is categories and tags, other than that a post is just a collection. Collections get you the ability to group things and then just loop over those things efficiently.

With pages (a page is anything that is not a post or a collection item) you can use front matter to do stuff, the main issue is that you have to run thru every single page in order to do stuff and on larger sites that can get slow, but it works and as a bonus compared to posts you don’t have to name them with the date.

You could probably work around the issue with symlinks. For example:

├── _posts
│   ├── 2023-11-21-post1.markdown
│   └── go -> ../go
├── go
│   └── foo.go