Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Links in menu, posts sorting, tag based parsing and rules #55

Open
MorphicResonance opened this issue Jun 9, 2021 · 1 comment
Open
Labels
question Further information is requested

Comments

@MorphicResonance
Copy link

Template question. How to edit template to not include link into site menu to the same page. For example on the site of weblorg we go on the page "Blogging". Into the footer of this page we see active link to the same "Blogging". I want to make such links inactive.

Post sorting. Is there way to make sorting of posts not just as datestamps but under other conditions. Be able to pin one post higher than others.

Is there a plan to make publishing with weblorg from defined node of any .org file. I mean that some function may parse .org files search for tagged nodes (as :blog: or :publish: , something like this) and create .org files for weblorg. Then run standart publishing procedure.
This can be developed with cascade of functions into Elisp . For me this can be really realized with python script Orgparse.

Do you plan to develop an autoextraction of first n-words of the post (anounce) for index page of the blog?

Idea of tags as rules for the choice of template(route). If I have one file tagged as :blog: and other tagges as :homepage: being in one folder they will be processed with different templates. So users be able to have not only flat real site structure but also the same flat/virtual on desktop.

@clarete
Copy link
Collaborator

clarete commented Sep 5, 2021

hi hi @MorphicResonance, sorry it took me quite a bit to get to this issue. here goes my attempt to answer your questions:

Template question. How to edit template to not include link into site menu to the same page. For example on the site of weblorg we go on the page "Blogging". Into the footer of this page we see active link to the same "Blogging". I want to make such links inactive.

after parsing each Org-Mode file, weblorg attaches the route object (currently providing only the name attribute) to the parsed structure. That way, when that file is rendered, the route.name attribute will be the route that file belongs. I ended up just using that to make manual comparisons when building the menu of the weblorg documentation website theme. e.g:

<li><a href="{{ url_for("index") }}">home</a></li>
<li{% if route.name == "docs" %} class="active"{% endif %}>
    <a href="{{ url_for("docs", slug="index") }}">documentation</a>
</li>
<li{% if route.name == "api" %} class="active"{% endif %}>
    <a href="{{ url_for("api") }}">api reference</a>
</li>

this is an excerpt from the layout file weblorg's website.

Post sorting. Is there way to make sorting of posts not just as datestamps but under other conditions. Be able to pin one post higher than others.

I tried to get ready to answer this question by publishing some preliminary documentation on how aggregation functions work.
and also took a stab at documenting what you already seem to know about the sorting via timestamps and the date attribute:

That said, the short answer to this question is no. There is no aggregation function that sorts posts in any way that's different from the timestamp. That is indeed something wanted and any insights in how we could get a nice API to allow that to happen would be very much appreciated.

If you allow me some rambling: Sorting might be too special of a situation to the point that it'd be nice to decouple it from the aggregation. if that's the case, meaning that they're really actually better to be handled together, maybe sorting still needs its own set of parameters instead of just relying on new aggregate functions being written that don't really change aggregation but just sorting. (this is what we have right now, we have aggregate functions with and without the suffix -desc. With this current style, the API might grow quite repetitive, and we won't be able to re-use the sorting. I feel like following changes would allow us to accommodate more flexible sorting:

  1. Make weblorg--compare-posts-desc public (and maybe be explicit about the fact that it's sorting with the date attribute)
  2. Add something like :input-sort to weblorg-route so we can take the sorting function as a parameter to be applied to whatever aggregate function
  3. deprecate the -desc aggregate functions in favor of sorting functions with the -desc suffix (maybe we don't need to deprecate them, maybe they can just be shortcuts to providing :input-aggregate and :input-sort 🤷🏾)
  4. Identify what other useful sorting functions we could ship by default

Is there a plan to make publishing with weblorg from defined node of any .org file. I mean that some function may parse .org files search for tagged nodes (as :blog: or :publish: , something like this) and create .org files for weblorg. Then run standart publishing procedure.
This can be developed with cascade of functions into Elisp . For me this can be really realized with python script Orgparse.

this question reminds me of the discussion in #18. this feels like perfect use-case for :input-source. And I think it'd be cool to see new packages that extended weblorg instead of depending on different packages. My goal has been to limit the pipeline as little as possible to any specific use-case, but to adhere to a very small feature set. It may sound a bit contradictory, but the goal is to make it extendable so other people use it as a library.

Do you plan to develop an autoextraction of first n-words of the post (anounce) for index page of the blog?

That sounds very useful, and I think it'd be a good template filter to add to templatel even. (I bet there's something along those lines in jinja that we can get the inspiration from)

Idea of tags as rules for the choice of template(route). If I have one file tagged as :blog: and other tagges as :homepage: being in one folder they will be processed with different templates. So users be able to have not only flat real site structure but also the same flat/virtual on desktop.

hmm, I feel like this can be achieved with a custom :input-filter function. We only have one public API that relies on that property currently.: https://emacs.love/weblorg/api.html#symbol-weblorg-input-filter-drafts
that's used to filter out Org-Mode files that have #+DRAFT: t on them. https://emacs.love/weblorg/doc/file-properties.html#draft
I wonder if we could provide a nice and cliean weblorg-input-filter-tags or something like that. Would that be something you could use?

@clarete clarete added the question Further information is requested label Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants