Pelican-Elegant / elegant

Best theme for Pelican Static Blog Generator
https://elegant.oncrashreboot.com/
MIT License
293 stars 187 forks source link

Allow About Me to be written in rST or Markdown #85

Closed tshepang closed 5 years ago

tshepang commented 10 years ago

Curremtly, LANDING_PAGE_ABOUT is used for that, which is not ideal, especially since it needs (I think) to be written in raw html. Perhaps a solution where this file is read off some file somewhere?

(encouraged by https://github.com/talha131/pelican-elegant/pull/77#issuecomment-29552207 to request a feature before 2.0 gets released)

talha131 commented 10 years ago

That would be great. How can this be done? Jinja discourages and doesn't let you put logic into template. There is no straight forward way to do it in Elegant theme.

Possible solutions are to create a Pelican Plugin or change Pelican code base.

calfzhou commented 10 years ago

If user has a page with slug about or about-me, it might be very easy to include the page content in index template.

talha131 commented 10 years ago

Hmm, so Elegant will have to iterate over the pages and find the one that has about-me slug and then put its content into "About me" section. Cool idea, seems workable.

What if user wants to use this slug but don't want it to be put in Elegant's section?

tshepang commented 10 years ago

She can make use of LANDING_PAGE_ABOUT, maybe set it to False or None.

talha131 commented 10 years ago

This will not stop Pelican from generating "About Me" page. It will also be present in Pages variable so "about-me" will have to be skipped where ever Pages is used.

What if we miss skipping some where? How will this filtering affect performance?

IMHO, a cleaner way is to have a About Me plugin. It can call Pelican classes and methods to convert the markup into html.

codecachet commented 5 years ago

Shouldn't there be a way in Pelican to create any particular section of text (like the About Me) from markdown? What if I wanted, say, a Message of the Day to appear in the right column of each page? How would I go about putting this md content in its own file, and have it treated as a "section", rather than a page?

codecachet commented 5 years ago

Figured out an easy way to do this. Put "About Me" markdown in a page, but make it status: hidden. Then in the index.html template (class="article-content"), just look in the list hidden_pages for the page which has the correct title, and insert the page.content.

talha131 commented 5 years ago

@codecachet very cool. Love it. Let me know if you can open a PR.

talha131 commented 5 years ago

@iranzo can you find time to implement what @codecachet has suggested?

This is in Q3 milestone, it's not as urgent as tasks in Q2 milestone.

iranzo commented 5 years ago

I was having a look at this yesterday night, I need to find how to loop in jinja for this and then extract the data and make the relevant code changes

iranzo commented 5 years ago

Talha, do you have a pointer on how to perform the loop against the filter for articles? Not familiar enough with pelican templates for writing the loop for this :-/

talha131 commented 5 years ago

Can you try

{% for article in articles %}
{% if article.status == blah and article.title == "Landing Page About Me" %}

I think we need a specific title for the article we are going to use for about me.

talha131 commented 5 years ago

@tshepang and @calfzhou, it took five years 😆 but the feature is finally here. Currently in beta.

https://next.elegant.oncrashreboot.com/customize-home-page

(You may have to add ssl error exception to visit the page. Netlify SSL has some issue.)

It gives me immense pleasure to close a five year old feature request.

talha131 commented 5 years ago

@all-contributors please add @codecachet for ideas

allcontributors[bot] commented 5 years ago

@talha131

I've put up a pull request to add @codecachet! :tada:

talha131 commented 5 years ago

:tada: This issue has been resolved in version 3.0.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: