Closed marekkowalczyk closed 3 years ago
You can just use ctrl+f in browser. I guess some simple php for searching could be useful if in the future categories on separate pages would be introduced.
@Morelcia I assume the point is to not have a serverside preprocessor. Currently the side is literally assembled through a shell script. A search box with a JS filter function that has an array of pages would do just fine, and would be serverside. It simple enough and light enough to not need to be cached (which means we could just put it in the head of the script).
Afaik point is to be as lightweight as possible clientside and to work without js. +serverside js abominations definitely aren't lightweight unless you meant something else.
@Morelcia definitely not serverside. Client side small amount of javascript (6 to 10 loc), inside the
<script>
tag.
I can make a PR of something like that tomorrow, but the general sensus against Javascript here is pretty obvious, so I am pinging the community about how much is not "a lot". Since the amount of script I want to add is miniscule, it has no need to exist in a separate Network call to import the Javascript. So we can put it in the <head>
tag, or at the bottom of HTML and forget it.
When you don't import the stuff in a separate file, it doesn't get cached. But since the amount of code is so small, there is no need for caching.
@Godje I see you point, and if you ask me i have no problem with minimal JS. but i don't think luke and the community will approve that. he was pretty clear about a no JS policy.
How about an alphabetized static index page of user-marked [[keywords]]
?
Something along the lines of
grep -HE \\[\\[.+\\]\\] *.md | sed -e 's/\[//g' -e 's/\]//g' -e 's/\.md//' | awk -F ':' '{print "<a href=\"" $1 ".html\">" $2 "</a>"}' | sort | uniq -u
(not actually usable as is because it doesn't collect occurrences of a keyword in different files into one entry, but you get the idea).
How about JavaScript on the server-side? http://www.cgi-node.org/. PHP is cringe.
Why would someone run backend in language which runtime takes 500MB ram in idle? unironically php>nodejs
@Morelcia lol no it doesn't
ok serious this time, the most efficient thing would be a c++ nginx plugin.
ctrl+f should be more than enough
the laziest way would probably be bash-cgi script.
ctrl+f should be more than enough
The chad way to search is to use the inbuilt search.
actually making a duckduckgo search form would be even easier
<form action="https://duckduckgo.com/">
<input type="text" name="q">
<input type="hidden" name="sites" value="based.cooking">
<button type="submit">Search</button>
</form>
what you guys, think? I'll make a PR If you guys think it's a good idea. Would between the tags and the "Recipe" header be a good place to put it?
Cannot see anything wrong with Ctrl-f, or / if you are using Vim keybindings. This might become a problem with thousands of recipes, maybe, but right now its not a problem at all.
@adeptflax I just tried what you did by just adding it in the devtools, and it genuinely works. This way we are not increasing the size of the website on the VPS, and we are increasing the search ratings for the based.cooking URL lol :)
Ctrl-f is more than sufficient now while all recipes are still on the main page.
If the site gets large enough, we will get a php search or something of the sort.
Let's have a search box, in due time.