WordPress Post Preview
luisherranz opened this issue Β· comments
Hey guys, we've added support for the ?preview=true
query! π
This is related to the source auth option in the https://github.com/frontity/docs/issues/228 issue, so maybe it'd be a good idea to do it together.
That issue explains that now you can add a header to authenticate against the REST API.
This PR adds support for the ?preview=true
query in the post type handlers that ship with wp-source
. If they find the query, they use state.source.auth
to authenticate and retrieve the last revision of a post. That way, when the user clicks on the preview button, the content that is shown is the content of the preview, like in WordPress.
We added a feature to the Embedded mode PoC to send a JWT in the ?frontity_source_auth
query that ends up in state.source.auth
, but that's not the only way to authenticate against the REST API to make the preview work. As long as you populate the state.source.auth
with a valid Authorization header it will use that and it should work.
For example, it could work with these plugins:
So I guess we should investigate other methods to make this work, apart from the Embedded mode PoC plugin.
@luisherranz We are going to document the embedded mode architecture here and also document the the plugin here, and we'll treat this issue as part of that documentation.
Great idea π
@SantosGuillamot maybe we should have a chat and decide what we are going to do with the Embedded mode plugin?
@SantosGuillamot maybe we should have a chat and decide what we are going to do with the Embedded mode plugin?
Do you mean in terms of documentation? We can have a chat if you feel it will be useful π Just so you know, we have just merged a Pull Request to add a really simple interface to enter Frontity URL and we're planning to finish the opened issues for the moment. Once that is done, I could submit an initial version to the WordPress plugins repository.
Oh, that's fine then π
Architecture section rewritten - frontity/docs#296
Embedded mode plugin documented - #34