-
Notifications
You must be signed in to change notification settings - Fork 29
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
setup REST API endpoints for sites outside the network #45
Comments
it may be best if the endpoint just returns the raw data -- url, anchor text, parent id, is active, etc -- and the block generates the markup. that way the markup generation can be DRY, and we won't have to change the endpoint in the future if we want to change the markup, reuse it in other contexts, etc. |
🤔 , although, that would mean Trac etc have to generate matching markup, which will probably lead to things being out of sync. So maybe the endpoint should just call We might want one endpoint for the header, and one for the footer? If it'd help avoid News-specific styles bleeding into the global markup, we could setup a site like |
Could the endpoint simply be a static HTML file, that's re-rendered periodically (or at deploy)? |
🤔 How were you picturing the static HTML would get updated? Would it include everything in Even if we don't use that for production, it might be good to setup stub endpoints soon with a copy/paste of the HTML/CSS. That'd allow folks to start work on Trac etc, while a dynamic solution is figured out here. |
These are still experimental and may change significantly. See #45
I started to create static stubs, but tried out the dynamic approach in 373b3fe just to see what would happen. Luckily it didn't take much to get it working. We'll need to test it out on Trac, Openverse, etc to see if it meets all the various needs, though. |
@zackkrida , what do you think about these endpoints?
They're very rough/experimental. Let us know if a different approach would work better for you, if you'd need some customizations (like for |
@iandunn Those are awesome! This approach is fine. Some specific things I've noticed you may be aware of:
|
🤔 good catch. It looks like the script for it isn't being enqueued. I'll add a task for that 👍🏻
I'm guessing that's just because the inlined styles rely on external stylesheets that are included in the header. Once both are embedded on the same page, it should work. I haven't tested that yet, though. |
Ah, that makes sense, thanks! |
Implemented headers for WordPress Planet & Codex via #62
In doing that, I've also fixed the above issues - the header had to be rendered on the footer endpoint, to ensure that anything the header triggered to be enqueued was output in the footer, and removed the
Implementing this into Trac is going to require a bunch more work..
In all honesty, A static header for Trac is going to more viable. A middle-ground might be an external script to simply run to update the Trac templates, using a After the above issues are fixed, we end up with this: ** Removed Image, see WordPress/wordpress.org#50 for a more up to date one ** |
😆 , good catch!
Ouch. Can Genshi be configured to use HTML5? Or maybe we could migrate to Jinja2? It seems like it supports HTML5. I'm not sure how far along Trac's support is, though. There's also the genshihtml5 extension But yeah, a static option may be simpler, as long as we can automate it. |
That only affects it's output, not it's input templates.
Jinja is the default trac template now I believe, but I don't think writing a new theme for Trac is of the upmost importance right now.. The
Looks like I failed to mention WordPress/wordpress.org#50 here - I've got a simple PHP script in that PR that uses |
These were fixed in WordPress/wordpress.org@e3318ae |
Ugh, Too many issues covering the same things :) Trac is over here: #53 |
Ah, nice! That WFM 👍🏻 |
Moving to post-launch, since the work we've done so far has gotten Profiles/Trac/Codex working. |
Profiles, Trac, Codex, etc can't load the new header/footer directly; either because they're on a different multisite network, or because they're not WP at all.
the best solution might be to create REST API endpoints that output the markup and inline styles. they could basically just call the blocks and buffer the output, I'm guessing.
Profiles is probably the easiest to test on, since there's no docs on how to setup a Trac/Codex local env (if that's even practical), or on how to access the production instances
It'd be nice to create a standard WP-API endpoint, though.
wp_head()
on their end, but integrate results into<head>
styles
route to fetch only the global styles<title>
wp_head()
/wp_footer()
things like<link>
that aren't meant for the clientdie()
hack, sendtext/html
properly through API insteadThe text was updated successfully, but these errors were encountered: