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

Front matter image source #9

Open
davestewart opened this issue Mar 12, 2021 · 5 comments
Open

Front matter image source #9

davestewart opened this issue Mar 12, 2021 · 5 comments

Comments

@davestewart
Copy link

davestewart commented Mar 12, 2021

Description

Better customisation of image source selection

Expected Behavior

I would be able to programatically choose the image source in frontmatter, using a string path or perhaps a function:

image_sources: [
    page => page.frontmatter.media.thumbnail || page.frontmatter.image
],

Actual Behavior

It seems the code only picks a frontmatter node called image but I want to pick one at media.thumbnail

Also, when the code moves on to use regex to grab a page tag, it ends up with:

<meta name="twitter:image" content="https://davestewart.co.uk/./screens/loading.png">

Also, note that this link shows a path relative the actual page - is there some way to get round this?

In my own code, I resolve the path and then require().

The compiled page (the image was just in markdown) actually shows this:

<img src="/assets/img/loading.143ab32a.png" alt="">

Steps to Reproduce

N/A

Your Environment

Sorry removed this as didn't think it was a bug before.

But, Node 12, latest everything else.

Great plugin, thanks for your hard work!

@webmasterish
Copy link
Owner

Hello @davestewart

Thanks for the feedback!

I'm currently quite busy and don't think I have any free time to go through this. If you have a solid solution, please feel free to submit a PR.

@davestewart
Copy link
Author

Hello!

I've gotten it working locally using a bit of copy / paste, so perhaps I'll do this in due course :)

@webmasterish
Copy link
Owner

Cool!

@davestewart
Copy link
Author

BTW... your brace, padding and comment style creates about 50% more lines than are actually needed in the file.

For example your source is nearly 900 lines, yet mine is < 600. It makes it quite hard to read vs, say Standard JS.

Would you consider a PR with a linting setup added?

@webmasterish
Copy link
Owner

I'm well aware of all the "standards" and all the linting tools, but that's how I write my code and that's how it's readable to me, and I wouldn't change it for every new standard/linting that comes along.

Thanks for taking the time to look into it and offering to do it, but I must say no.

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

No branches or pull requests

2 participants