- /
- src/
- pages/
- docs/
- doc1.md
- doc2.md
- public/
- images/
- some_dir/
- image1.png
- image2.png
// doc1.md
---
title: Markdoc example
description: Markdoc syntax examples
---
# Hello Tailwind UI

While working locally, the generatePath
function returns always an empty object, because the environment variable CI
isn't set.
So the file path is always something like /images/some_dir/image1.png
.
While building the static page via a CI/CD pipeline ( in this case, we're using GitLab Pages ), the environment variable CI
is set to true
.
Based on this, we fetch the project path ( via CI_PROJECT_PATH
) and remove the group name from the path.
We only need the subfolder name ( if you have one ) and the repository name.
We have to prepend the path to the given image path.
The result path after building the site will be something like:
/some-directory/repository-name/images/some_dir/image1.png
NextJS provides some config parameters to modify the asset/base path - But unfortunately this works only for images with a static path.
Since we have a dynamic path, the configured assetPath
will not be prepended automatically.