permalinks icon indicating copy to clipboard operation
permalinks copied to clipboard

Migrating from v2 to v3 generates a lot of breaking changes

Open oupala opened this issue 1 year ago • 0 comments

Describe the bug While migrating from v2 to v3, there is a huge difference in the way other resources (than markdown) are treated.

To Reproduce Steps to reproduce the behaviour:

  1. Config
  .use(permalinks({
    pattern: ':title',
    slug: {
      replacement: '-',
      remove: /[*+~.()'"!:@]/g,
      lower: true,
      extend: {
        "'": '-'
      },
      duplicates: 'error'
    }
  }))
  1. Build

standard build

  1. See error

no error but other resources files are not copied to the build directory

Expected behaviour A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment

  • Linux
  • Node.js v20.11.0 and npm v10.5.1

Additional context Add any other context about the problem here.

Here is the content of the source directory src/content/tutorial:

test.txt
images/
index.md

Here is the content of the corresponding build directory build/tutorial:

build/tutorial
build/tutorial/index.html
build/tutorial/index.html.gz

We can see that the txt file is not copied to the build directory, nor is the images directory and its images resources (that are included in the markdown file).

So the question is: how can we embed other resources that markdown files in the build directory?

The advice mentionned in the documentation (Maintaining relative links) is the following:

Our advice is to keep your media in an assets or similar folder that does not undergo path transforms, and reference it with a root-relative URI

But it is not an option for us as each document is in its own git repository with its own image resources.

How should I configure metalsmith permalink so that image resources follow their markdown document where the url is defined by the title attribute of the frontmatter of the markdown document?

oupala avatar Apr 10 '24 15:04 oupala