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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make HTML template configurable: (Make <head> tag fully customizable) #13
Comments
@jbmoelker With Sapper how would you end up setting the Possible Elder.js Solutions:I'll continue thinking on this issue, but the three solutions I can see are:
Issues With Each Option:
Questions to investigate:
Notes on Hooks: When building Elder.js we started out with 27 hooks. There was a hook for everything. In sharing it with a private group of devs the resounding feedback was that hooks are powerful but there were just too many. The current implementation is the smallest amount of hooks we could identify that still allowed us to solve all of our edge cases on elderguide.com. As of this writing, I think we should be very cautious about adding additional hooks and instead explore giving users extremely fine grained control of the priority functions are executed on each hook even allowing them to override the priority defined by plugin hooks. For example, the biggest downside to using the As it currently stands the 1-100 priority scale (with 1 being highest priority) is enforced by Elder.js and it sets a cap on the priority functions are run at. Long term we may want to revisit this scale and see if the strict enforcement of it makes sense for user defined functions. (We could also invert the scale and allow users to define a priority with 101 or higher.) |
@jbmoelker So the more I've thought about this the more I believe your current hook implementation is actually the desired one until there is a more fully fleshed out plan for i18n and community plugins supporting it. That said, another possible low hanging fruit solution would be to have Elder.js look for a I think living this issue open for more conversation about customizing the HTML template is worthwhile. If anyone reading this has ideas, we'd love to hear them. |
@jbmoelker I'm going to close this as I think a hook is the correct way to solve this specific issue. |
Hi @nickreese, you raise some good questions :) I'm not sure how you could pass more data to a Sapper template (I wasn't too satisfied with Sapper and haven't used it much since). I'm not sure I'm a big fan of my own solution using string replace in a hook. I imagine a hook could still work. It would maybe be nice if |
@jbmoelker that wasn鈥檛 a solution I considered. What hook would you suggest it on? |
Does that mean it would be appropriate to open a new issue to continue this discussion? I would like to change the <head>
${page.headString}
</head> They can anyway be easily customized in the |
@akvadrako Totally doable. We'll add |
@akvadrako Initial commit here, but for the sake of future proofing and remembering somewhere that the char encoding should always be first, I'm going to break these into two different hooks before releasing. |
@akvadrako pushed with v0.1.5. Also fixed a bug where stacks were being processed backwards. Doesn't fix the HTML lang issue, still open to coming up with a more official plan. |
For anyone that finds this, if you want to remove both meta tags, add |
@nickreese thanks for the quick fix. It's working well for me. |
This will be in v1. Elder.js now uses the |
馃憦 for starting a static site generator using a modern framework with 0kb client-side JS by default and optional client-side hydration!
Currently the HTML template is statically defined in
Page.ts
:It would be great if this template would be configurable, so for instance
html[lang]
could easily be changed.Maybe this can be offered through a hook, or by introducing a
src/template.html
file like in Sapper.This would help with #6, as I'm currently forced to overwrite the
html[lang]
with a hook:The text was updated successfully, but these errors were encountered: