How to store content for a site in separate files
Often site owners do not think about how to properly store content for a site, they write it directly on the site in a visual editor. However, this is not the best way, since in order to back up data, all content must be stored in a single standardized format separate from the site, which is easy to produce, edit, store and, if necessary, import content to the site.
In this case, the content will be stored not only in the site database and in the site file system, but also in universal files. Such files can be easily imported into any information system.
The most convenient format for writing articles for the site is the format of office documents - DOCX. In fact, this is just an archive, device DOCX format and how to open it is described in other articles.
The file itself must consist of pre-compiled sections, for example, at the top of the file there is a table with a description of the material:
- meta tags (minimum keywords and description), etc.
Next, content is placed directly, which usually contains different types of data:
- other objects.
When the material is written, the file can be easily imported to the site, for this it must be able to do so.
The system must be able to check whether a material exists with this name and type - if so, the material will be updated, otherwise it will be added. The program code usually includes an XML parser that is able to recognize not only content elements, but also their styles for quick transfer to the site. Do not forget about extracting images from DOCX into site folders so that they can be displayed on the site in the material just written. More detailed details of the work of importing content to the site from files will probably be discussed in other articles.
In conclusion, it remains to rename the DOCX file to the name of the article and save it to a specially prepared folder on a computer or other medium, where all data for a specific site is stored. For convenience, such a folder may contain subfolders named by dates in the format: 01.20, where 01 is the month, 20 is the year.
Accordingly, articles written this month can be added to each such folder. Such placement will make it easy to navigate a huge number of articles and, if necessary, find the right one. This is how a site content collection can be organized.
The ease of writing and publishing content on the site, as well as properly structured content storage will serve as an additional motivation to constantly replenish your collection with new articles. After all, to write an article, it will be enough to complete only two steps:
- open a sample DOCX article and write a new article based on your imagination and operating data (of course, if necessary, you may still have to spend time on making images in a graphic editor for an article, or you can just take screenshots);
- go to the site and import into the system (if necessary, for quick indexing, you can also inform the search engines about a new article).
Thus, keeping content separate from the site is a very important part of working on your project. Only this approach will allow you to quickly and easily develop, update and store content for the site. Moreover, the DOCX format is universal, you can develop a parser for any system on which the site is running.
- IT / Misc 08.07.21 How to make a free translation for a website without an API, translate documents in Google Translate
- IT / Misc 06.07.21 How to make a subscription button on a website, a subscriber base and automatic mailing
- Food / Misc 06.07.21 How to quickly cook delicious fried pies with potatoes and onions
- IT / Misc 04.07.21 Caching - create, load and reset. Where to store the cache, methods and types of caching
- IT / Database 03.07.21 Custom NoSQL - storing data in files and not only in a database. Storing settings, small data and caching files