From ef2aa525d589e2d71ed137e366a7ae537c79f323 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Tue, 14 Dec 2021 23:29:07 +0800 Subject: [PATCH] Add intro for `img_path` --- _posts/2019-08-08-write-a-new-post.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/_posts/2019-08-08-write-a-new-post.md b/_posts/2019-08-08-write-a-new-post.md index 68f0358..0914298 100644 --- a/_posts/2019-08-08-write-a-new-post.md +++ b/_posts/2019-08-08-write-a-new-post.md @@ -206,6 +206,31 @@ The parsing result will automatically add the CDN prefix `https://cdn.com` befor ``` {: .nolineno} +### Image path + +When a post contains many images, it will be a time-consuming task to repeatedly define the path of the images. To solve this, we can define this path in the YAML block of the post: + +```yml +--- +img_path: /img/path/ +--- +``` +{: .nolineno } + +And then, the image source of Markdown can write the file name directly: + +```md +![The flower](flower.png) +``` +{: .nolineno } + +The output will be: + +```html +The flower +``` +{: .nolineno } + ## Pinned Posts You can pin one or more posts to the top of the home page, and the fixed posts are sorted in reverse order according to their release date. Enable by: