Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable imsize to be used in _posts directory #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

dantler
Copy link
Contributor

@dantler dantler commented May 24, 2019

This patch corrects broken links generated by hexo-image-sizes in the scenario where post_asset_folder: true and the folder is a child of source/_posts.

Prior to this patch the {% imsize %} tags produce broken links when used inside the _posts directory. These links are broken because they include /_posts/ as a prefix to the src image.

Hexo removes the _posts prefix and replaces it with the permalink path specified in the config file. Prior to this patch, hexo-image-sizes does not know to do this. This patch introduces new behavior to remove the _posts directory if it is present in the source path.

Note that this fix has only been verified in two scenarios (hexo new page and hexo new post), and only on my Windows machine.

Also note that I have not separated this patch from my previous chain of fixes, since I am currently running Windows. I can produce a separated patch for upstreaming if you can test it.

Prior to this change, this plugin did not produce proper links
for images inside my `sources/_posts` directory.  The links seemed
to be generated in the _posts directory, which was not part of the
paths generated by hexo in the posts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant