wordpress-to-jekyll-exporter icon indicating copy to clipboard operation
wordpress-to-jekyll-exporter copied to clipboard

Bug? Empty variables are removed from frontmatter

Open kevinpapst opened this issue 1 year ago • 3 comments

I promise this is one of the last 5 issues I open 😁

You have that code in place inside convert_posts which removes certain frontmatter variables. I am using Jekyll since years now and Liquid has kinda autoboxes certain values like PHP, but I am using a lot of bool and empty string values in my current wordpress theme to check for conditions.

https://github.com/benbalter/wordpress-to-jekyll-exporter/blob/403fc70d8a61f526fe34ab74d7b9faa65aa8394f/jekyll-exporter.php#L280-L284

When I do the export, half of the variables are missing in my frontmatter in certain files. This makes it more complicated for me to write the correct code, because I cannot assume that the fields are always there. Maybe its just my dev brain that tries toi make it failsafe, but also larger search&replace actions are more complicated, because the keys are available in some files and not others.

I simply commented the unset line, but I wanted to point out that this behavior is (for me) unexpected. An exporter should export and not make decisions of what is a key of value and which ones are "use-less". Can I ask for the why of that code?

I can raise a PR to remove this foreach, but I guess this one is again a matter of opinion and I can also include it in a PR where I am going to add some docs for the next person.

kevinpapst avatar Oct 17 '24 06:10 kevinpapst