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

Modifying multiple blog posts from one page #25

Open
neeldhara opened this issue Dec 15, 2023 · 1 comment
Open

Modifying multiple blog posts from one page #25

neeldhara opened this issue Dec 15, 2023 · 1 comment

Comments

@neeldhara
Copy link

I need the testimonial-style editing UI that's available on the front page for blog articles. In particular, I am envisioning a "listing page" that lists all the blog titles in a table or list, and I'd like all of those titles to be editable.

It appears that the testimonials are saved as one JSON dump in the DB, while the articles get their individual entries/rows in the DB. I wasn't able to figure out how to adapt the code to suit my use case: I do want the articles/blog posts to retain their individual identities in the DB, but I'd like to be able to move them around (ideally this is a custom ordering that gets saved on the go, specific to the "listing page") and edit the titles simultaneously as well.

I am afraid I know nothing about how Svelte works, so sorry if this is somehow an obvious adaptation of the existing code.

PS. Off-topic, but many thanks for making this awesome template and workflow!

@michael
Copy link
Owner

michael commented Jan 3, 2024

Hey! Sorry for taking me sooo long to respond. The testimonials are "self-contained" within one page (the page just has one JSON data field in the database) while the blog posts (articles) are separate entites in the database, with fields for title, content (html) and some metadata.

See: https://github.com/michael/editable-website/blob/main/sql/schema.sql

You could easily come up with a listings table powered by a custom SQLite query. For simultaneous edits of titles you'd need to come up with some infrastructure, basically a rest endpoint that takes an array of article_id + title pairs and update them accordingly in the datbase (see api.js). You can basically achieve anything that can be done with Svelte and SvelteKit, but the template is only meant as a starting point, so I think if you want to do more advanced things, studying Svelte/SvelteKit is important.

Hope I wasn't too late and this is still helpful for you. All the best!

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

No branches or pull requests

2 participants