dragonman225 / notablog

Tell stories of your work with Notion
https://dragonman225.js.org/notablog.html
MIT License
667 stars 80 forks source link

Support for letting `index.html` be a post, and the links to blog entries be on a separate page. #51

Open mTyETy opened 1 year ago

mTyETy commented 1 year ago

By default, the list of blog entries is displayed on the index.html page. However, I wonder if I can change this behavior so that the list can be displayed on a different page, such as blog.html.

I would also like to be able to set the index.html page as a blog post. This would greatly allow me to use the home page for information only, and leave the links to blog posts in a separate page.

I am also curious if it's possible to extend the customization options of Notablog beyond the existing templates like index, tags, and posts. The idea is to let Notablog generate a corresponding page under the /public path based on this template that I add. This would provide a convenient way to create custom pages with personalized layouts.

Thank you very much for your attention to these requests.

dragonman225 commented 1 year ago

index.html as a blog post

This is requested from time to time, and I've seen a few people did it, though I didn't dig into how they did it. An example. Maybe you just fill in index in the url field of the page which you want to make home page in your Notablog table and it will overwrite the simple list index.html?

If that doesn't work--if you write code, you can fork Notablog and hard-code the page you want it to be index.html in the code and write the list page to another file.

By the way, Notion's own publishing feature also works like what you want--you can set a home page that links to another page containing a list or a gallery of your posts. And that's why Notablog was built--when you don't want to write anything for the home page and you think it's too awkward to present a Notion database, you want an auto-generated, custom-style, simple list.

More customization

I think you already can customize the style and layout of a post, for example, let post A have normal font and white background while post B have monospace font and black background, by duplicating post template, changing it, adding the filename to the template select and selecting it. (There's not much documentation on this since nobody seems to need it, including me 😂.)

I'm not sure if I understand your need accurately. But beyond this type of customization, Notablog may not be a good tool. If you write code, you can look into Notablog's code and see if changing it requires reasonable effort, otherwise, you may want to use Next.js, Gatsby, or something similar to build your custom logic. You can combine it with a Notion page renderer, for example, nast-util-to-react, the same one that powers Notablog, or react-notion-x, which seems to be more popular and more well-maintained, or other ones you find satisfied.

mTyETy commented 1 year ago

Thank you very much! I have overwritten the index.html page and added a new template bloglist.html for another page for links to blog entries. This is very satisfying for now.

dragonman225 commented 1 year ago

Glad to hear that! By the way, would you like to share the link of your website? I'm curious about how bloglist.html look.

mTyETy commented 1 year ago

I just copied the content of the default index.html template straight into bloglist.html and did nothing else.

My site is pretty much under construction, so I feel rather embarrassed to share it. Sorry about that :p

dragonman225 commented 1 year ago

I just copied the content of the default index.html template straight into bloglist.html and did nothing else.

So you create a dummy Notion page with no content and set its template to bloglist.html (which contains the same thing as the default index.html template) and you'll get the post list generated there? Sounds clever! (a nice discovery, I checked the code and this is indeed possible!)

My site is pretty much under construction, so I feel rather embarrassed to share it.

I see. Feel free to share when it's done, or not, if you prefer to keep it private!

mTyETy commented 1 year ago

So you create a dummy Notion page with no content and set its template to bloglist.html (which contains the same thing as the default index.html template) and you'll get the post list generated there? Sounds clever! (a nice discovery, I checked the code and this is indeed possible!)

Exactly! ☺