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

Add schema as a post setting #18248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CPatchane
Copy link

@CPatchane CPatchane commented Sep 20, 2023

Hello 👋

According to this documentation, Ghost automatically handles the Article schema for each post, which is great. However, it is not possible to customize it to use something different from Article.

The use case here is to have the NewsArticle schema. Here is what I suggest in that PR:

  • Allow a new setting in the post settings, so that the user can choose the NewsArticle schema instead of the default article.
  • Use that flag in schema.js to create a dedicated NewsArticle schema for that post.

I tried to make things work correctly, but I am not able to save the update. When I change the dropdown value and click on Update, I receive a success message (PUT 200) about the post being updated, but it still uses the previous value. What did I miss here?
Thanks in advance for your support.

Note: The dropdown was a good choice for me since it can easily be extended to other schemas, like Recipe for cooking blogs.

Screenshot 2023-09-20 at 14 34 14
  • There's a clear use-case for this code change, explained below
  • Commit message has a short title & references relevant issues
  • The build will pass (run yarn test:all and yarn lint)

🤖 Generated by Copilot at c9e50a7

This pull request adds a new feature to Ghost that allows users to select a schema type for their posts, either 'article' or 'newsArticle'. The schema type is a metadata attribute that affects how the posts are displayed and indexed by search engines and social media platforms. The pull request modifies the post model, validator, service, exporter, and schema helper to support the new attribute, and adds a new component and a migration to handle the user interface and the database changes. The pull request also updates the tests and the mock server to reflect the new feature.

Allow to use NewsArticle schema
@github-actions github-actions bot added the migration [pull request] Includes migration for review label Sep 20, 2023
@github-actions
Copy link
Contributor

It looks like this PR contains a migration 👀
Here's the checklist for reviewing migrations:

General requirements

  • Satisfies idempotency requirement (both up() and down())
  • Does not reference models
  • Filename is in the correct format (and correctly ordered)
  • Targets the next minor version
  • All code paths have appropriate log messages
  • Uses the correct utils
  • Contains a minimal changeset
  • Does not mix DDL/DML operations

Schema changes

  • Both schema change and related migration have been implemented
  • For index changes: has been performance tested for large tables
  • For new tables/columns: fields use the appropriate predefined field lengths
  • For new tables/columns: field names follow the appropriate conventions
  • Does not drop a non-alpha table outside of a major version

Data changes

  • Mass updates/inserts are batched appropriately
  • Does not loop over large tables/datasets
  • Defends against missing or invalid data
  • For settings updates: follows the appropriate guidelines

@CPatchane
Copy link
Author

Any updates for this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
migration [pull request] Includes migration for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant