Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with redirect_from directive in a better way #1397

Closed
eksperimental opened this issue Apr 23, 2018 · 5 comments
Closed

Deal with redirect_from directive in a better way #1397

eksperimental opened this issue Apr 23, 2018 · 5 comments
Assignees
Labels
bug discussion Elixir School discussion

Comments

@eksperimental
Copy link
Contributor

eksperimental commented Apr 23, 2018

When we decided to move English language lessons from https://elixirschool.com/lessons/ to https://elixirschool.com/en/lessons/
we added the redirect_from directive to every lesson.
for example
en/lessons/advanced/typespec/ has this frontmatter:

---
version: 1.0.2
title: Specifications and types
redirect_from:
  - /lessons/advanced/typespec/
---

the problem with this is that when people translate the page, they leave that as it is, and there is one URL that redirects to two different language versions, so the old link is randomly taken over.

My suggestion for the time being is:

  1. add a warning in the README file to remove every occurrence of redirect_from
  2. remember when reviewing the lessons added, that it cannot contain a redirect_from (I just approved one today and totally overlooked ay this)
  3. add a comment before the redirect_from directive asking translators to remove it, such as this for example:
---
version: 1.0.2
title: Specifications and types
# PLEASE remove the `redirect_from` directive below if you are translating this lesson
redirect_from:
  - /lessons/advanced/typespec/
---

/cc @elixirschool/developers

@eksperimental eksperimental added bug discussion Elixir School discussion labels Apr 23, 2018
@doomspork
Copy link
Member

Thanks for bringing this up @eksperimental. I think #3 would be the easiest. If we want an excuse to write some Elixir an MVP review bot could check for redirect_from and version updates (or lack thereof).

@nscyclone
Copy link
Member

Since only the old English lessons require redirects maybe it makes sense to use redirect_to in the former paths instead? Then the lessons themselves won't have any unrelated parts in front matter and there would be nothing to be accidentally copied into translations.

@eksperimental
Copy link
Contributor Author

True! why haven't we thought of that before

@eksperimental
Copy link
Contributor Author

I will tackle this

@eksperimental eksperimental self-assigned this Apr 26, 2018
@doomspork
Copy link
Member

Wonderful, thank you @eksperimental!

eksperimental added a commit to eksperimental-forks/elixirschool that referenced this issue Apr 26, 2018
It creates a .md file with the "redirect_to" directive for every lesson,
in order to avoid translators to copy the "redirect_from" directive

Closes elixirschool#1397

Script for creating the new redirect files

for d in $( ls -1 en/lessons/ ); do
  mkdir -p lessons/${d}
  for f in $( ls -1 en/lessons/${d}/ | sed -e 's/\..*$//' ); do
    echo -e "---\nredirect_to:\n  - /en/lessons/${d}/${f}/\n---" > lessons/${d}/${f}.md;
  done
done
doomspork pushed a commit that referenced this issue Apr 28, 2018
It creates a .md file with the "redirect_to" directive for every lesson,
in order to avoid translators to copy the "redirect_from" directive

Closes #1397

Script for creating the new redirect files

for d in $( ls -1 en/lessons/ ); do
  mkdir -p lessons/${d}
  for f in $( ls -1 en/lessons/${d}/ | sed -e 's/\..*$//' ); do
    echo -e "---\nredirect_to:\n  - /en/lessons/${d}/${f}/\n---" > lessons/${d}/${f}.md;
  done
done
doomspork pushed a commit that referenced this issue Apr 28, 2018
It creates a .md file with the "redirect_to" directive for every lesson,
in order to avoid translators to copy the "redirect_from" directive

Closes #1397

Script for creating the new redirect files

for d in $( ls -1 en/lessons/ ); do
  mkdir -p lessons/${d}
  for f in $( ls -1 en/lessons/${d}/ | sed -e 's/\..*$//' ); do
    echo -e "---\nredirect_to:\n  - /en/lessons/${d}/${f}/\n---" > lessons/${d}/${f}.md;
  done
done
doomspork pushed a commit that referenced this issue May 3, 2018
It creates a .md file with the "redirect_to" directive for every lesson,
in order to avoid translators to copy the "redirect_from" directive

Closes #1397

Script for creating the new redirect files

for d in $( ls -1 en/lessons/ ); do
  mkdir -p lessons/${d}
  for f in $( ls -1 en/lessons/${d}/ | sed -e 's/\..*$//' ); do
    echo -e "---\nredirect_to:\n  - /en/lessons/${d}/${f}/\n---" > lessons/${d}/${f}.md;
  done
done
doomspork pushed a commit that referenced this issue May 31, 2018
It creates a .md file with the "redirect_to" directive for every lesson,
in order to avoid translators to copy the "redirect_from" directive

Closes #1397

Script for creating the new redirect files

for d in $( ls -1 en/lessons/ ); do
  mkdir -p lessons/${d}
  for f in $( ls -1 en/lessons/${d}/ | sed -e 's/\..*$//' ); do
    echo -e "---\nredirect_to:\n  - /en/lessons/${d}/${f}/\n---" > lessons/${d}/${f}.md;
  done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug discussion Elixir School discussion
Projects
None yet
Development

No branches or pull requests

3 participants