scholarslab / scholarslab.github.io

World Wide Web site! For the Scholars' Lab!
https://scholarslab.lib.virginia.edu
12 stars 7 forks source link

Htaccess redirect implementation #247

Closed amandavisconti closed 5 years ago

amandavisconti commented 6 years ago

http://brettterpstra.com/2013/04/20/wordpress-to-jekyll-handling-redirects/ looks interesting

jeremyboggs commented 6 years ago

Currently running the site through W3C's Link Checker recursively. Will post results here, and we can discuss possible solutions.

jeremyboggs commented 6 years ago

So far nothing 404s, but we have a ton of URLs that generate 301 redirects because we don't add a trailing slash at the end. I've created #248 to specifically address this.

jeremyboggs commented 6 years ago

We also explicitly ignore a number of status codes—403, 404, and 410—in our Rakefile when we run HTMLProofer on the site. I imagine because we have a bunch of links that do this, and the travis test would fail of we don't ignore these.

Amanda created #268 to address this (suppressed status codes)

amandavisconti commented 6 years ago

The previous solution I was using above isn't what we need. I'll just not push the branch I was trying the plugin out in (ghost-link-fixin).

@jeremyboggs or @mossiso, would you be willing to create redirects in an gtaccess file for the list above plus any other redirects we need?

amandavisconti commented 6 years ago

Also links that point explicitly to scholarslab.org

amandavisconti commented 6 years ago

Figure out what to put in htaccess to do this

amandavisconti commented 6 years ago

Think I can't test this out until we've got the production site off GitHub Pages servers.

amandavisconti commented 6 years ago

From redundant issue #26: Internal links are using the wordpress formulation for slugs, which includes categories. Our slugs won't have that, so the links are breaking. I think we're going to have to address this with some thoughtful redirecting with htaccess. Unless we'd like to use the existing permalink structure? I think I'd prefer the latter, given how much content this issue affects.

amandavisconti commented 6 years ago

@jeremyboggs @mossiso Do yall have a sense of when you may have time to set up the production version of SLab.org (off GitHub Pages)? And let me know if there are things I can do first to make that possible. Thanks! Once this is done, we can create htaccess file with redirects, write documentation for moving stuff from GH Pages dev site to live site, identify who has access/authorization to make changes to production site and how to ping them when you want to push a change.

ammonshepherd commented 6 years ago

Working on that this week. Next week I'm out for conference and Digits meeting, so probably nothing solid until week of Aug 13.

amandavisconti commented 6 years ago

@mossiso Do you know the status of this?

ammonshepherd commented 6 years ago

I got busy with server migrations and haven't worked on this in September. If I remember a conversation from @jeremyboggs right, for now we are just going to push to the server directly, and figure out the automatic pull from GitHub later.

amandavisconti commented 6 years ago

@jeremyboggs @ammonshepherd There's a redirect-from plugin supported by GitHub, but it creates a page for any old URLs we want to redirect from, which seems a bit messy? But we could implement it for the short-term release. Or research other options. I think my main concerns are the static pages at new URLs, e.g. scholarslab.org/about/charter => scholarslab.org/charter

amandavisconti commented 6 years ago

Going to set up the inelegant Jekyll redirect-from plugin for now to deal with this issue

amandavisconti commented 6 years ago

WP site post structure: /%category%/%postname%/

Example posts: http://scholarslab.org/uncategorized/string-theory-or-lets-explore-social-networks-with-string/ Uncategorized

http://scholarslab.org/uncategorized/a-toolkit-the-public-domain/ Digital Humanities, Grad Student Research, Uncategorized

http://scholarslab.org/digital-humanities/text-mining-and-digital-humanities/ Digital Humanities

WP Categories: "WordPress generates a single permalink using the category with the lowest ID". Job Announcements is a child category of Announcements, but Job Announcements was only used for 4 posts (all of which use just Announcements in the URL, e.g. http://scholarslab.org/announcements/job-opening-curious-about-focusing-on-dh-development/)

amandavisconti commented 6 years ago

Updated navbar logic to leave out pages without nav = true, instead of with nav = false. This makes it so that the redirect pages generated by jekyll_redirect_from don't get added to the navbar!

EDIT: I think I ended up deleting that work, since not using jekyll-redirect plugin => we weren't getting weird blank pages in the navbar

amandavisconti commented 6 years ago

Committed work to the 247 branch before messing with blog permalink structure. See bookmarks for help retaining archival blog post URL structure (lowest-ID-category/title) but structuring future posts better (YYYY/MM/DD/title?).

Can use defaults scope to separate archival & new posts and treat their URL structure differently? But need to first figure out how Jekyll handles

  1. no categories (for archival posts, need to add Uncategorized to post YAML)
  2. multiple categories (need to pick the one with the lowest ID number; not sure how Jekyll currently picks—YAML list order, maybe?) May just need to do nested search (if contains ID 1, move that category to top of YAML list; if no ID 1 but ID 2, move that category to top of list, etc.)
amandavisconti commented 6 years ago

On hold while Ammon and Jeremy work on post-commit hooks (possibly done by end of this week? 11/16), workflow for our own servers.

amandavisconti commented 6 years ago

Ammon is currently working on htaccess redirects, per Jeremy

amandavisconti commented 6 years ago

@ammonshepherd @jeremyboggs Known needed redirects:

Unknown whether need redirects:

amandavisconti commented 5 years ago

I believe @jeremyboggs has implemented our redirects for nginx