Closed (fixed)
Project:
OpenAI SEO Analyzer
Version:
1.0.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Nov 2023 at 14:36 UTC
Updated:
25 Dec 2023 at 07:09 UTC
Jump to comment: Most recent
Comments
Comment #2
j-vee commentedThe issue with renderPlain ends up being is that it doesn't produce the same full HTML page as a HTTP request does and it therefore isn't the right tool here. What I did with the latest release though was that I changed file_get_contents function to use Drupal's HTTP Client service instead.
Comment #3
scott_euser commentedAs in you want the actual html? Just ::render() instead of renderPlain() should do it maybe? Just needs to be on the right object for the level you want (eg, html, page, node, field level). Essentially if Drupal builds it for the end visitor it should also be able to build it for you without needing to make the http request
Comment #4
scott_euser commentedHere, "solution 2": https://www.hashbangcode.com/article/drupal-9-render-drupal-page-within-...
Comment #5
j-vee commentedThat solution 2 actually worked. Great suggestion, thanks!
It's a pretty convoluted way of putting the HTML render together. I'll probably make a separate service to handle this to keep things a bit cleaner.
Will include this in a future release so I'll re-open this for now.
Comment #6
j-vee commentedLatest update to dev-branch fixes this and there's now a new service that renders a given entity's view mode in HTML. Thanks!
I also generalised the service a bit so that it can now take:
I think with those options this module could be extended to do a lot of things.
Comment #7
j-vee commented