D
D
dom1n1k2016-03-19 02:45:04
HTML
dom1n1k, 2016-03-19 02:45:04

Post processor for HTML?

I need to make a website with articles, like a blog. That is, the main page is a list of articles, you can go inside and read each one. No database, no admin panel is needed - everything will be written and typed manually. It would seem that nowhere is easier.
The highlight is that each article is supposed to be unique. Each page can be designed in its own way, its own layout, its own styles, its own fonts. Some kind of branding. Of course, there will still be something in common between them, but there will be many differences. In other words, in addition to global statics, each article can have its own styles, scripts, pictures, etc.

// то есть помимо
http://site.com/css/
http://site.com/images/
http://site.com/js/

// ещё должны быть
http://site.com/article-title/css/
http://site.com/article-title/images/
http://site.com/article-title/js/

An aggravating circumstance is that articles can be in several parts:
// оглавление
http://site.com/article-title/

// части
http://site.com/article-title/1/
http://site.com/article-title/2/
http://site.com/article-title/3/

And each part should have access to the styles of its chapter. And you need navigation between them.
You can, of course, just type it stupidly in HTML and hand-to-hand sort it into folders. Cheap and cheerful. But I want to be able to do things like this inside:
<link rel="stylesheet" type="text/css" href="{{ basePath }}/css/style.css">

<link rel="stylesheet" type="text/css" href="{{ articlePath }}/css/style.css">

<a href="{{ articlePath }}">К оглавлению</a>

<a href="{{ articlePath }}/{{ nextChapter.number }}">{{ nextChapter.title }}</a>

I was considering doing it on some PHP microframework, using this as a router and templating engine. But something didn't work. They all assume the location of the templates somewhere inside the app, and all the statics somewhere in public or assets. There will be porridge. And I'm not ready to wedge into the code of the framework.
Then I decided that I needed a static site generator. A similar story is a sea of ​​​​alternatives, but it is not clear what to take. Everywhere there is only one folder with templates and one with content. The generator inserts one into the other and produces a hundred identical pages.
I would like to find some kind of HTML post-processor that would be able to replace certain mnemonics with links, paths, variables from the config, and so on. And if something has changed, then we change it once in the config and regenerate it.
Is there something like that? For example, for Gulp. (of course I searched, but the results are not very good)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Andrey Khokhlov, 2016-03-19
@andrhohlov

As an alternative to "hand-to-hand" with jade - jekyllrb.com
Can be hosted on github

D
Dmitry Kalyuk, 2016-03-19
@kalyukdo

jade, you need jade-lang.com
cool thing, after a year of working with jade, I don't even want to look at pure html

I
Ilya Erokhin, 2016-03-24
@AirWorker

You won't find it, and you don't really need it.
For things like this, gulp + jade is perfect. Everything can be done very cool, but you still have to tinker. Learn gulp, jade, sass and of course Noda.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question