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

add current-html-render-head-prefix #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jeapostrophe
Copy link
Contributor

No description provided.

@jeapostrophe
Copy link
Contributor Author

I'm working on a Scribble site where I want to put Google Analytics on every page.

I know I can do this with a head-extra, but it is difficult to make sure I include it on every single part. I was hoping that I could use some global configuration option to do this, but looking at

https://docs.racket-lang.org/scribble/config-style.html

I can only add files to the output, add CSS, and add to the prefix. Since the prefix is before the HTML tag, I can't use it to insert things into the head.
I tried to hack the render-mixin to automatically insert on render-part, but changing the style on the part made references not work. I also think this wouldn't be a good way for non-Racket hackers to do it. Similarly, I'm pretty sure it would make the script appear multiple times if a page had multiple parts.
Instead, I did this. If you like it, I'll add docs.

@jeapostrophe
Copy link
Contributor Author

Ping @mflatt

@mflatt
Copy link
Member

mflatt commented Nov 6, 2020

Sorry that I missed this, even with the ping.

I like the idea of a way to set a head addition everywhere, but I think it still works better to make it a property — one that gets propagated automatically to nested parts that are on their own page, or even lifted to the enclosing page if the property is no a same-page nested section. That's how css-addition and similar work, so you can use the existing exrtact traversal helper. The style-property approach tends to work better for Scribble documents, because there's generally not a good place to put a parameterize (and mutating a parameter has its own issues).

@mflatt
Copy link
Member

mflatt commented Nov 6, 2020

... and maybe head-extra should have worked that way in the first place.

Rechecking the documentation, I don't think it's clear on css-addition. It talks about lifting CSS additions up on the same page, but not about propagating to other pages for nested sections. I'll improve the docs.

@mflatt
Copy link
Member

mflatt commented Nov 6, 2020

Since I ended up spending time in this area, here's a specific proposal: mflatt@7c7e121

@jeapostrophe
Copy link
Contributor Author

jeapostrophe commented Nov 6, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants