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

Block examples documentation #6560

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
Draft

Block examples documentation #6560

wants to merge 13 commits into from

Conversation

erral
Copy link
Member

@erral erral commented Dec 30, 2024


I have reviewed the block documentation, converted some code blocks from class components to functional components, and provide an example of a simple block.


📚 Documentation preview 📚: https://volto--6560.org.readthedocs.build/

@erral erral requested a review from stevepiercy December 30, 2024 16:00
Copy link

netlify bot commented Dec 30, 2024

Deploy Preview for plone-components canceled.

Name Link
🔨 Latest commit 4d75f66
🔍 Latest deploy log https://app.netlify.com/sites/plone-components/deploys/67740b780a013b00088e9546

@ichim-david
Copy link
Member

Thank you for writing this @erral . It's awesome when an experienced Volto developer takes some time to pass on some of this hard-earned experience and writes some documentation. You are awesome for doing this.

I plan on giving it a read sometime this week to see if there is anything that I can help with in potential suggestions. But again, thank you for doing this.

Copy link
Collaborator

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great stuff. Thank you!

I created a related PR to define Glossary terms at plone/documentation#1829, which needs to be merged before this PR to pull them into this PR's docs preview.


customschemaandview
customviewandvariations
customviewvariationsandschemaenhancer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename all the above files with dashes between words to improve SEO.

---
myst:
html_meta:
"description": "Volto block examples."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"description": "Volto block examples."
"description": "Volto block examples"

myst:
html_meta:
"description": "Volto block examples."
"property=og:description": "Volto block examples."
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"property=og:description": "Volto block examples."
"property=og:description": "Volto block examples"

html_meta:
"description": "Volto block examples."
"property=og:description": "Volto block examples."
"property=og:title": "Block examples"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"property=og:title": "Block examples"
"property=og:title": "Volto block examples"

"keywords": "Volto, React, blocks, example, edit, view, Plone"
---

# Volto Block examples
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# Volto Block examples
# Volto block examples


With all the block components ready, you need to register the block into Volto.

To do so, open your addon's {file}`index.js` file, that will have the following contents:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To do so, open your addon's {file}`index.js` file, that will have the following contents:
To do so, open your add-on's {file}`index.js` file, and add the following contents.

export default applyConfig;
```

And before the last `return config;` statement, write the following configuration:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
And before the last `return config;` statement, write the following configuration:
Before the last `return config;` statement, write the following configuration.

},
],
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change


```

On the top of the file you will need to import the relevant components, as follows:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On the top of the file you will need to import the relevant components, as follows:
At the top of the file, import the relevant components as follows.


Your block is ready to be used in your site.

Restart your Volto site and you will be able to add it using the block add form.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Restart your Volto site and you will be able to add it using the block add form.
Restart your Volto site, and you can add it using the block add form.

@ichim-david
Copy link
Member

@erral once you apply @stevepiercy suggestions and you feel that the work is ready for review you can add me as a reviewer if you would like, I volunteer to read the docs and give any potential suggestions if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants