hermanp / website

Source code of personal website. Based on Wowchemy Hugo theme.
https://hermanp.github.io
2 stars 1 forks source link

Make a treeview of bookmarks in Resources menu #2

Closed hermanp closed 3 years ago

hermanp commented 3 years ago

Requested feature

I want to show my bookmarks :bookmark: on a page in the Resources menu. This will force me to keep them tidy and also let others knew what I am interested in. I do not want all my bookmarks to show up, just part of them.

Context

This widget is called treeview, but similar effect can be achieved with the accordion. The look should be something similar to a directory treeview or somehow it should be foldable. It would be good to have a description or "story" of the bookmark, this should be like an HTML tooltip (title attribute) or another level of folding or just display it without any hassle. Would be nice to display the bookmark's favicon also.

Search history

:arrow_forward: Something like Windows Explorer's file tree? It's a tree graph, maybe "graph" should help :next_track_button: "windows explorer file tree graph" :arrow_down_small: Tree view of a directory/folder in Windows? - Stack Overflow :arrow_up_small: :twisted_rightwards_arrows:

:next_track_button: Google search: hugo collapsible markdown

Suggestion

Preferably without JavaScript, just plain CSS and HTML.

:x: treeview or accordion widget :x: description of each bookmark - this page has to be version controlled because of updates of bookmarks. If the markdown is edited after generated, then it won't be automatic, therefore this feature is discarded. Maybe they can be discussed in separate blog posts. :x: favicon

hermanp commented 3 years ago

For importing and generating content from JSON (search hugo json to md OR markdown):

Seems rather complicated. :confused: :expressionless: Rather just generate at need the markdown file by R. So currently I see two possibility:

hermanp commented 3 years ago

Oh, man! To make \<details> nested and treeview like, I would have to use Javascript and CSS? Maybe at the next iteration. Trying to just parse the JSON file to a nested unordered HTML markdown list.

hermanp commented 3 years ago

I feel miserable. After so much work the end product is not a big deal... However, better than nothing. The process is somehow documented in the following two Stack Overflow posts:

As for the favicons: I modified the code to make it able to download them, however it is not what I expected.

  1. The favicons have a dedicated column in the respective bookmark folder's table. These URLs are sometimes contain the fake-favicon-uri: string and sometimes missing. Most of the times seems good.
  2. Generally, the favicons can be accessed in the way as documented by the following Super User post: How to download favicon from website?. This means, if I don't have an URL in the iconuri field, then I can construct it from the host name. I have done this, but many times this leads to redirection (eg. HTTP status code 301) or not found (status code 404) and even when found, its content type are diverse. Data (from 404 favicons in my bookmarks):
Status code Count
200 356
404 47
503 1
HTTP content type Count
image/png 182
text/html 57
image/vnd.microsoft.icon 79
image/x-icon 72
text/plain 1
image/svg+xml 6
image/jpeg 4
image/icon 1
application/xhtml+xml 1
image/gif 1

There were only 10 errors during downloading favicons.

  1. This means, I have to present a "missing favicon" icon for bookmarks not having favicon. This is getting even more complicated, and I decided to stop here and get away with links in a nested list.
  2. Now, the bonus is to make a table of contents about them because it isn't clear on the site. Its possible, even if it is ugly! Yay! Just make each levels of folders into a corresponding header also! Like - # Info and - ## Python
hermanp commented 3 years ago

Next thing to do is: make it transparent or get rid of the list item markers before those list items, which are headings. This seems like a CSS question. Hints:

headers_list_item_markers

hermanp commented 3 years ago

OK. Seems this tale ends here. What I wanted above is what should be called parent selector, which is not implemented yet. (But in draft phase, see: :has() - Mozilla Developer Network). Tried to twist the logic for selecting, but can not be done. Relevant questions:

Decided to remove the list item markers altogether.

hermanp commented 3 years ago

The list item markers removed from all of the Resources pages, but not from the Post pages. Because there is bigger need for them than the excess of them. Visual evidence:

Unordered list without marker

I needed to revert the CSS modification 8d39fc450b98123f3a823524ed79b79ed844cde2.