Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it good idea to save HTML content to database? [closed]

I am creating a blog-app project in Angular 7. Using firebase cloud functions as a backend and doing CRUD operations by saving html content to firebase using Angular - CKEditor component.

It looks like this in firebase

content: "<p>Sample Blog Post</p><img src="someLink">"

and then I render that string in the page

<div [innerHTML]="content"></div>

I think this approach called WYSIWYG(What You See Is What You Get) and works perfectly fine but I feel like this is not the efficient way.

I wanna have a blog website with just blog posts no other features. Is there any problem with that approach for my case ? Can you recommend any other solution if there is a problem ?

Thank you.

like image 909
Berat Akgül Avatar asked Dec 14 '18 02:12

Berat Akgül


1 Answers

  1. There's absolutely nothing wrong with your approach of saving HTML to a database.

    In fact, that's how Wordpress works.

  2. FYI, "WYSIWYG (What You See Is What You Get)" typically applies to things like editors:

https://en.wikipedia.org/wiki/WYSIWYG

WYSIWYG (/ˈwɪziwɪɡ/ WIZ-ee-wig)[1] is an acronym for "what you see is what you get". In computing, a WYSIWYG editor is a system in which content (text and graphics) can be edited in a form closely resembling its appearance when printed or displayed as a finished product,[2] such as a printed document, web page, or slide presentation.

like image 131
paulsm4 Avatar answered Oct 30 '22 23:10

paulsm4