Automatic "<!--more-->" and number of posts per page


since I started writing on my blog, I’ve been using <!--more--> to make sure the blog only shows a portion of each post in the main page.
So far, I’ve been adding it manually after the first paragraph or so, but is there a way (maybe via Javascript) to have add <!--more--> automatically when it generates the blog from markdown, after a certain amount of words? This would make the main page look a bit tidier.
Hopefully this doesn’t sound too outlandish, but I come from Jekyll where this could be achieved (not using JS though).

On the topic of keeping the main page “lighter”, is there any way to control the amount of posts being displayed per page?
I’d like to customize the footer of the main page, but that only works if users can see the footer in the main page with very little scrolling, I think.

Thank you :slight_smile:

Hi @Melyanna,

The <!--more--> markup is actually something that needs to be in the content of the post. That way the server recognizes it and renders the markup differently. If it was appended to the HTML of the post via JavaScript, the markup would just appear as text, not doing any of the markup magic it is supposed to do.

That means that the automatic <!--more--> has to be done programmatically using the API. There are different approaches but it can be done. One way could be transforming a text, each time including the the markup in a specific place, and then publishing it through the API.

Custom number of posts per page is a great idea. It currently is not supported but is in consideration for future development. You can follow its progress here. Thanks for bringing all of this up!

Thank you, @cjeller1592!
I am really looking forward to the option of controlling the amount of posts in the main page.

Re: this sounds like something I wouldn’t be able to do (currently being hosted on, but that could be done by anyone managing a write freely instance?

It is aimed to be a feature for both and WriteFreely, so you will be able to do it hosted on as well!

1 Like