feat: add legacy urls in the posts list page

This commit is contained in:
Hugo Poissonnet 2022-12-09 15:33:48 +01:00
parent a4299fd65a
commit 681d85997a
3 changed files with 1769 additions and 18 deletions

View File

@ -103,5 +103,19 @@ documentation of Hugo
This solution is promising This solution is promising
// TODO IMAGE // TODO IMAGE
## Webcrawler
It's simple crawler/webspider, I develop some times ago for the fun.
`./console.js https://blog.hugopoi.net/ --output-format json --progress`
`> crawled 499 urls. average speed: 37.32 urls/s, totalTime: 13s`
`jq '. | length' blog.hugopoi.net_urls.json`
Now let's filter this file and order it.
`jq '. | map(select((.metas.title != null) and (.url | test("\\?replytocom") == false))) | .[].url' blog.hugopoi.net_urls.json`
`jq '. | map(select((.metas.title != null) and (.url | test("(\\?replytocom|^https://blog.hugopoi.net/v2)") == false) and (.url | test("/[0-9]{4}/[0-9]{2}/[0-9]{2}/[^/]+/$")))) | sort_by(.url) | reverse' blog.hugopoi.net_urls.json > blog.hugopoi.net_urls.filtered.json`
* Remove ` HugoPoi` from the titles
`jq '. | map(.metas.title |= sub(" HugoPoi"; "")) | .[].metas.title' blog.hugopoi.net_urls.filtered.json`

1738
v2/data/LegacyBlogUrls.json Normal file

File diff suppressed because it is too large Load Diff

View File

@ -27,24 +27,23 @@
</h2> </h2>
</li> </li>
{{ end }} {{ end }}
{{ range $i,$line := getCSV "," "./localhost_urls.csv" }} {{ if (eq .Type "post") }}
{{ $url := index $line 0 }} {{ range $.Site.Data.LegacyBlogUrls }}
{{ if and (ne $i 0) (eq (len (findRE `replytocom` $url 1)) 0)}} <li>
<li> <h2>
<h2> <a href="{{ .url }}">
<a href="{{ index $line 0 }}"> <svg
<svg class="bookmark"
class="bookmark" aria-hidden="true"
aria-hidden="true" viewBox="0 0 40 50"
viewBox="0 0 40 50" focusable="false"
focusable="false" >
> <use href="#bookmark"></use>
<use href="#bookmark"></use> </svg>
</svg> {{ .metas.title }}
{{ index $line 2 }} </a>
</a> </h2>
</h2> </li>
</li>
{{ end }} {{ end }}
{{ end }} {{ end }}
</ul> </ul>