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
Remove empty title
tags in generated tests
#2166
Comments
Update: The initial issue was brought up due to empty In Instead of removing the |
title
tags in generated teststitle
tags in generated tests with default value
Hi @lhw-1, thank you for working on this in PR #2186. Sorry for the late comment but I am wondering if there's a need to replace the empty title. As you mentioned in the details, the issue is initially on the generation of an empty "title" element when there is no "title" declared, or when the title is implicitly set as "". I agree with @ong6 that if we can confirm that empty title elements serve no other purposes and do not raise any errors when omitted, then removing it is fine. Replace the empty title element, however, will require us to provide a good default such that this default is better than having no default. So here are some things that I feel we need to consider:
Feel free to do some research and let me know what you think about the above. |
I've looked into some of the other static site generators mentioned by @tlylt, and the approaches seem to be quite mixed, though after looking at all the alternatives, I think that showing the URL of the page (as is being done) should be fine without needing to replace the header. Gatsby and Docusaurus, after some basic testing on my system, seems to simply defaults to the URL of the page if no title is given (both in their front matter and site configurations equivalent). Jekyll, on the other hand, seems to take the name of the file and will capitalize it as the page title is none is given, which does seem to result in unwanted consequences for some users, but I think this is also an alright approach, if a bit unintuitive compared to the default. And MKDocs has not fully figured out the right way forward either 😅 This issue opened for MKDocs outlines a good discussion of the different thoughts on the matter, but overall, their current method seems be to extract the page title from the file name, similar to Jekyll.
So after looking through alternative approaches, I fully agree on this point, and without a good reason to override this, it would probably be better to leave the default behavior as it currently is. I will change back the issue to simply removing any empty |
title
tags in generated tests with default valuetitle
tags in generated tests
Please confirm that you have searched existing issues in the repo
Yes, I have searched the existing issues
Any related issues?
#2128
Tell us about your environment
Ubuntu 20.04
MarkBind version
4.0.2
Describe the bug and the steps to reproduce it
The issue was brought up during the code review in PR #2128 where functional tests generated for template files will have an empty
title
tag if it has not been defined insite.json
, even if it was defined in thefrontmatter
of the markdown file. An example can be seen here.Expected behavior
The
title
tag should not be generated in the first place if there is no title declared.Anything else?
No response
The text was updated successfully, but these errors were encountered: