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

Theme Export: Strip out site specific details #42730

Closed
scruffian opened this issue Jul 27, 2022 · 9 comments
Closed

Theme Export: Strip out site specific details #42730

scruffian opened this issue Jul 27, 2022 · 9 comments
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.

Comments

@scruffian
Copy link
Contributor

Description

The theme export process already removes theme slugs from template parts, as when templates come from files these aren't needed. Similarly we should remove other site/implementation specific details from templates on export, including:

  • Removed the ref id on the Navigation block
  • Remove IDs from the image block
  • Remove IDs from the query block

There may be more like this that we need to remove.

Step-by-step reproduction instructions

  1. Add some items to the navigation block in your theme
  2. Export your theme using the site editor
  3. You will see a "ref id" in the template for the navigation block - this won't have any meaning on another site.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@carolinan
Copy link
Contributor

Adding the dev documentation label because once this is solved this page in the theme developer handbook can be updated:Creating new themes using the Site Editor

@Mamaduka
Copy link
Member

Maybe we can make this part of the _remove_theme_attribute_in_block_template_content so we don't have to parse template content multiple times during the export.

@jffng
Copy link
Contributor

jffng commented Jan 24, 2023

I opened a PR for this in wordpress-develop: WordPress/wordpress-develop#3899

Let me know if that's not a good approach. I wasn't sure how best to do this in Gutenberg, since it's a utility function and not a part of a class, I can't overwrite it like we handle the backports and class overloading for global styles, etc.

@jffng
Copy link
Contributor

jffng commented Feb 13, 2023

Remove IDs from the query block

Just an update that based on this feedback, we should leave the queryIds in the query markup.

@carolinan
Copy link
Contributor

@WordPress/block-themers Is this still something we want to do? Does it cause any errors?, or is it only confusing?
If it is only confusing, perhaps this issue could be closed?

@t-hamano
Copy link
Contributor

As far as I know, the site-specific information contained in the blocks is at least the following. There may be more.

  • Audio block: id, src
  • Cover block: id, url
  • File block: id, href, fileId, fileName
  • Gallery block: url, fullUrl, link, id, ids
  • Image block: url, id,
  • Page List Item: id
  • Video: id, src

More site-specific information may be added to existing or new blocks in the future. Also, we have no control over the site-specific information contained in custom blocks. So, it can be hard to process all this information.

If we want to implement such functionality, the Create Block Theme plugin may be a better choice.

@MaggieCabrera
Copy link
Contributor

@WordPress/block-themers Is this still something we want to do? Does it cause any errors?, or is it only confusing? If it is only confusing, perhaps this issue could be closed?

I'd agree with @t-hamano that this is better solved via CBT. The site specific info still makes sense for the use case of a backup of the same site. I'd say it's ok to close or if we still consider this to be interesting to do in core, make it an option

@mikachan
Copy link
Member

I agree that we can close this, even if just to deprioritise it for now. Create Block Theme already handles a lot of these site-specific details as of this PR: WordPress/create-block-theme#522 (included in version 2.0.0 of the plugin).

@t-hamano
Copy link
Contributor

Thank you everyone for your feedback. Let's close this issue for now.

Feel free to reopen it if you think it would be ideal to have this issue resolved in core.

@t-hamano t-hamano closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

10 participants