nicercode / EnvironmentalComputing

These are the R markdown files used to generate
http://environmentalcomputing.net/
Creative Commons Attribution 4.0 International
16 stars 6 forks source link

When page name has changed from Wordpress site, add alias #23

Closed dfalster closed 2 years ago

dfalster commented 2 years ago

Sometimes the new page may have a slightly different name to the old site.

By adding an alias, we can redirect the old link to the new link.

Instructions from https://gohugo.io/content-management/urls/#example-aliases suggest add an alias to the yaml front matter

---
aliases:
    - /posts/my-original-url/
    - /2010/01/01/even-earlier-url.html
---

So need a list of pages on old and new site for comparisons.

I'm trying to generate one using linkchecker https://linkchecker.github.io/linkchecker/

dfalster commented 2 years ago

To run linkchecker, install, then

 ~ linkchecker --check-extern  -odot --output="csv" -v http://environmentalcomputing.net > output.csv
 1 thread active,     0 links queued,    0 links in   1 URL checked, runtime 1 seconds
10 threads active,   109 links queued,   20 links in 139 URLs checked, runtime 6 seconds
10 threads active,   100 links queued,   29 links in 139 URLs checked, runtime 11 seconds
10 threads active,   101 links queued,   29 links in 140 URLs checked, runtime 16 seconds
10 threads active,   151 links queued,   63 links in 222 URLs checked, runtime 21 seconds
...

Awesome, i now have a list of links form the old site (and found some broken ones)!!!

dfalster commented 2 years ago

Here's the list we need to tick off. This is list of pages in the existing wordpress site. We need to find the corresponding page in our current structure, and add the text below in the yaml. As in the example at b517a7205227c38742582ff8ecf7e00f9233776d

fontikar commented 2 years ago

Thanks @dfalster hope the proccessing didn't take forever! I am on it! Will install linechecker too! how cool!

dfalster commented 2 years ago

Hi @fontikar

I've uploaded a new page with all the aliases we wanted listed (see https://brave-bose-da028a.netlify.app/aliases/). Some don't appear to be working. Running link check, these are the ones that aren't working

linkchecker --output="csv" -v https://brave-bose-da028a.netlify.app/aliases/ > output2.csv
library(tidyverse)
data <- read_delim("output2.csv", skip = 3, delim = ";")
data %>% filter(result != "200 OK") %>% pull(urlname) %>% writeLines("fails.md")
fontikar commented 2 years ago

Sorry you had to chase this up and be the middle person! I am on it! I left this thinking they have never changed from the original forgetting they are now under the new nested structure!

dfalster commented 2 years ago

Thanks @fontikar

dfalster commented 2 years ago

Great work team!