Adding few blank components that would make extending easier #1443
palmiak
started this conversation in
Feature Requests
Replies: 4 comments 2 replies
-
Thanks for the suggestion @palmiak! Would you mind expanding a bit on any specific use cases, e.g. things you’d have loved to be able to slot into one of these four suggested locations? |
Beta Was this translation helpful? Give feedback.
0 replies
-
The simplest thing - all weird marketing scripts, or adding some
functionality like OG:image (instead of overwriting head component).
czw., 1 lut 2024, 16:02 użytkownik Chris Swithinbank <
***@***.***> napisał:
… Thanks for the suggestion @palmiak <https://github.com/palmiak>!
Would you mind expanding a bit on any specific use cases, e.g. things
you’d have loved to be able to slot into one of these four suggested
locations?
—
Reply to this email directly, view it on GitHub
<#1443 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR34OTR4V2ZQBHSHCE5LGDYROVAHAVCNFSM6AAAAABCT5QC7GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DGMZVHE3TA>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I would be interested in implementing those slots if you are interested.
Not pushing, but would love to help a bit 💪
Having real fun building our first docs using Starlight.
czw., 1 lut 2024, 19:13 użytkownik Chris Swithinbank <
***@***.***> napisał:
… Thanks — super helpful! I’m currently thinking about some head
improvements for things like the OG image, so it’s good to also hear about
similar needs elsewhere in the template.
—
Reply to this email directly, view it on GitHub
<#1443 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR34OTIXL7QTM2GOHVGLVTYRPLLNAVCNFSM6AAAAABCT5QC7GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DGMZYGE3DM>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I like the idea about the middleware-like solution. For sure it would be
much more extensible from the plugin perspective.
Such tool could be quite universal and there could be more slots not only
header.
Footer (or right after the body open - don't remember for sure) slot might
be useful for noscript tag for GTM for example. So more slots might be
useful in some cases.
czw., 1 lut 2024, 20:03 użytkownik Chris Swithinbank <
***@***.***> napisał:
… Aww, that’s nice to hear!
Given these use cases are not really for UI but for scripts (because
injecting elements into these locations would break layout in every case I
think), I’m wondering if there’s a better API. I have an item on my to-do
list to write up a proposal for an injectHead() tool, kind of like a
“middleware” system for stuff that ends up in head, because in a way
component overrides feel like an odd fit here and make it harder for e.g.
multiple plugins to be involved. Now with your extra context, I can
consider if there are other needs for a similar API.
In theory there’s not much need these days for scripts at the end of the
page with <script defer> although I guess if you really want to delay
queuing something up for download it could help.
—
Reply to this email directly, view it on GitHub
<#1443 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAR34OQEK74ZJXXLTXPZ4N3YRPRIXAVCNFSM6AAAAABCT5QC7GVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4DGMZYGU2TS>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What version of
starlight
are you using?0.17.2
What is your idea?
While adding things like OG is quite simple because we just have to override the
<Head />
, it is more tricky to add something to the bottom of the page (right before ).Overall, I was thinking that maybe it would be a good idea to add a few blank components, that we can use just for extending.
For example:
They would be placed in the
Page.astro
:As I mentioned - those components would be empty by default, so any overriding wouldn't break the core functionality.
Why is this feature necessary?
I think adding more components like this (and maybe it would be a good idea to add even more of them - not sure about this, only those 4 came to my mind as the most common ones) would make extending Starlight easier and safer because those components would serve more as "slots" to fill with some custom content.
Do you have examples of this feature in other projects?
The idea is a bit inspired by WordPress' hook system, where you create hooks that can be extended from other parts of the code.
https://www.hostinger.com/tutorials/what-are-wordpress-hooks/
Participation
Beta Was this translation helpful? Give feedback.
All reactions