> # Thoughts
>
> ```qinp!config
> route is "thoughts";
> enable watermark;
> ```
> ```qinp!run
> import "grouped";
>
> macro MAIN_ROUTE "thoughts";
>
> let thoughts_routes = grouped.load_subroutes_date_sorted(MAIN_ROUTE);
>
> let output = list.empty(string);
> for let i = 0; i < list.len(thoughts_routes); i += 1 {
> let route = thoughts_routes[i];
> if route == MAIN_ROUTE -> continue;
>
> let filename = str.split(str.strip_prefix(route, MAIN_ROUTE + "/"), ".")[0];
> if filename == "__qinp_source_code" -> continue;
>
> let date = str.replace(filename, "-", "/");
>
> let content = pinq.get_resource_static(route);
> if content.kind == option.None -> grouped.load_error(MAIN_ROUTE);
>
> output += "\n\n";
>
> output += "## Thought from " + date + "\n";
> output += "=> " + route + " Share\n\n";
>
> output += str.trim(content.Some);
>
> output += "\n\n";
> }
>
> grouped.echo_output(output);
> ```
>
> => home 🔙 Back to home
> ```qinp!run
> macro QINP_SOURCE_CODE "__qinp_source_code";
>
> fn load_error(what: string) {
> echoln "## Error";
> echoln "An error occurred, " + what + " could not be loaded";
> echoln "";
> echoln "=> home Back to home";
> terminate();
> }
>
> fn load_subroutes_date_sorted(route: string) string[] {
> let routes = pinq.list_routes_start_matching(route);
> // routes are dates, so sorts by date...
> list.sort(routes);
> // ...and reverse to get most recent at the top
> list.reverse(routes);
> return routes;
> }
>
> fn echo_output(output: string[]) {
> let length = list.len(output);
> if length == 0 {
> echoln "## Nothing here yet!";
> return;
> }
>
> for let i = 0; i < length; i += 1 {
> echo output[i];
> }
> }
> ```