There is an online journal site consisting of a main page and a set of articles - now they are all separate static pages such as index.html, article1.html, article2.html, etc. But there was a desire to arrange all this in the form of an application (SPA), so that there would be one template and just load the body of the article into it.

Question : in what form then store the text of articles on the server? Those. A lot of text with markup.

I get a solution using:

<link rel="import" href="/folder/article1.html"> 

Then, accordingly, I will keep the text of the article in the form of ready-made markup, but can someone know a more elegant solution?
For example, is it possible in some form to use json for this and how then to deal with the markup?

  • Most of the possibilities for registration will be in the storage of html, if you do not need more frills, perhaps markdown will do. Well, in the simple case of json, where, for example, a separate title, a separate text. - Vladimir Gamalyan
  • Why is there a SPA? Take any generator of static sites and do not shoot a cannon on sparrows. - andreymal
  • Well or WordPress, he has a comfortable admin panel.) - andreymal

1 answer 1

In my opinion, it is not good to mix the markup and the text itself.

I would separately keep for example, html nablon (s) into which, in turn, the data is loaded, which are dumped from the server in the form of json . How to store data on the server - in my opinion - it is not very important, you can generate these json on the fly, or you can store it as it is convenient for you