alfredbaudisch / pardall_markdown

Reactive publishing framework, filesystem-based with support for Markdown, nested hierarchies, and instant content rebuilding. Written in Elixir.
Apache License 2.0
115 stars 7 forks source link

Configure the remote repository clone path separately from root_path, for situations where the content is in a subfolder from the root #54

Closed alfredbaudisch closed 2 years ago

alfredbaudisch commented 2 years ago

This is both a bug but also an enhancement.

Scenario

The content is structured such that the markdown files are in subfolder inside the root:

website/
└───content/   <-------------
|   |   _index.md
|   |   post1.md
|   |   post2.md
|   └───art/
|   └───news/
└───static_assets/
|   |   img.png

In this situation we need to set root_path to ./repository/content and static_assets_path to ./repository/static_assets.

Problem

If the content is fetched with remote_repository_url from a Git repository, currently, it's cloned inside root_path. This way, with the current implementation, after PardallMarkdown clones the Git repository, the local folder structure will be:

website/
└───content/        <-------------
    └───content/    <-------------
    |   |   _index.md
    |   |   post1.md
    |   |   post2.md
    |   └───art/
    |   └───news/
    └───static_assets/
    |   |   img.png

As you can see, the nesting is wrong, and FileWatcher will send everything to be parsed as Markdown, ignoring the static files. Also, the slugs will contain /content/content two times.

Solution

Add a config to see the clone path, this way, the application can be configured as:

  remote_repository_local_path: "./website",
  root_path: "./website/content",
  static_assets_path: "./website/static",