Skip to content

Commit

Permalink
Setup URL forwarding with plain HTML files (#46)
Browse files Browse the repository at this point in the history
We were using subdomain forwarding (calendar.fatiando.org) for some hard
to remember URLs. This unfortunately doesn't work with HTTPS, leading to
some broken links and ugly warnings from browsers about potential
danger. Replace those with a simple HTML redirection structure in
subfolders. For example, `fatiando.org/calendar` now redirects to the
Google calendar link. Same for `fatiando.org/slack` and
`fatiando.org/good-first-issue`. There are instructions in the README
for adding new forwards.
A caveat is that we now have to be careful with the subfolders we create
here. But that's probably not going to be a problem since this website
is intentionally not very elaborate (it links to other resources).
  • Loading branch information
leouieda authored Dec 14, 2021
1 parent 7fc9678 commit 4c4e681
Show file tree
Hide file tree
Showing 15 changed files with 28 additions and 15 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ jobs:
- name: Set the CNAME file for our custom domain
run: echo "www.fatiando.org" > _build/html/CNAME

- name: Setup redirects to legacy.fatiando.org
run: |
for version in v0.1 v0.2 v0.3 v0.4 v0.5 dev
do
mkdir _build/html/${version}
echo "<meta http-equiv=\"Refresh\" content=\"0;url=https://legacy.fatiando.org\"/>" > _build/html/${version}/index.html
done
- name: Print a directory tree of the generated HTML for debugging
run: tree -a _build/html

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ linkcheck:
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

serve: html
python serve.py
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@ your browser. To stop the server, type `Control + C`.
* We use [Bootstrap 5.1](https://getbootstrap.com/docs/5.1/getting-started/introduction/)
(just the CSS, not the Javascript components).

### Forwarding

We use the HTML files in the `forward` folder to redirect to other domains.
This is not ideal but our DNS-based forwarding doesn't work with HTTPS (if you
know a way around this, please let us know!).

The files are copied to the output folder (`forward/dev/ -> _build/html/dev`
which is served as `fatiando.org/dev`).
To add a forward, create a new folder with an `index.html` similar to the ones
we already include.

**Use only for long and difficult to type URLs.**

## Deployment

Pushing changes to [fatiando/website](https:/fatiando/website)
Expand Down
3 changes: 1 addition & 2 deletions community/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ chat:
<li>

<i class="fa-li fab fa-slack fa-fw"></i>
[Slack][slack]: where most conversation happens about meetings, events,
<a href="/slack">Slack</a>: where most conversation happens about meetings, events,
questions, etc.

</li>
Expand Down Expand Up @@ -102,5 +102,4 @@ repository.
[contrib]: https:/fatiando/community/blob/main/CONTRIBUTING.md
[community-repo]: https:/fatiando/community
[gh]: https:/fatiando
[slack]: http://contact.fatiando.org
[notes]: https:/fatiando/community
4 changes: 2 additions & 2 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ def _get_authors(authors_md):
html_logo = "_static/fatiando-logo-background.png"
html_favicon = "_static/favicon.png"
html_static_path = ["_static"]
html_extra_path = []
html_extra_path = ["forward"]
html_use_smartypants = True
html_permalinks = False
pygments_style = "default"
Expand Down Expand Up @@ -159,7 +159,7 @@ def _get_authors(authors_md):
(
"fab fa-slack",
"Slack",
"http://contact.fatiando.org",
"/slack",
),
(
"fab fa-twitter",
Expand Down
5 changes: 2 additions & 3 deletions contact/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Your input is welcome and appreciated.
<i class="fab fa-slack fa-4x"></i>
<h2 class="no-top-margin">Questions</h2>

Hop on to our [chat room on Slack][slack] where you can **ask questions**,
Hop on to our <a href="/slack">chat room on Slack</a> where you can **ask questions**,
leave comments, and reach out to users and developers.

</div>
Expand Down Expand Up @@ -41,5 +41,4 @@ we post **news and updates** about the project.
[linkedin]: https://www.linkedin.com/company/fatiando
[twitter]: https://twitter.com/fatiandoaterra
[gh]: https:/fatiando
[bug-report]: https:/fatiando/community/blob/main/CONTRIBUTING.md#reporting-a-bug
[slack]: https://join.slack.com/t/fatiando/shared_invite/enQtNzY4NDQ3ODQwNDk4LTc5MTU5OWNkNTczMDY4NjcyNjcyZTU0Y2I3MDQ0NWUwMmEzMTBkNmVjNTExMGZkMjA0YzM1OGYyMzZlMDk3YTU
[bug-report]: https:/fatiando/community/blob/main/CONTRIBUTING.md
1 change: 1 addition & 0 deletions forward/calendar/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://calendar.google.com/calendar/embed?src=2brp0bfvui24atsvb0ridafk50%40group.calendar.google.com"/>
1 change: 1 addition & 0 deletions forward/dev/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://legacy.fatiando.org"/>
1 change: 1 addition & 0 deletions forward/good-first-issues/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https:/search?q=org%3Afatiando+label%3A%22good+first+issue%22+is%3Aopen+is%3Aissue"/>
1 change: 1 addition & 0 deletions forward/slack/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://join.slack.com/t/fatiando/shared_invite/enQtNzY4NDQ3ODQwNDk4LTc5MTU5OWNkNTczMDY4NjcyNjcyZTU0Y2I3MDQ0NWUwMmEzMTBkNmVjNTExMGZkMjA0YzM1OGYyMzZlMDk3YTU"/>
1 change: 1 addition & 0 deletions forward/v0.1/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://legacy.fatiando.org"/>
1 change: 1 addition & 0 deletions forward/v0.2/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://legacy.fatiando.org"/>
1 change: 1 addition & 0 deletions forward/v0.3/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://legacy.fatiando.org"/>
1 change: 1 addition & 0 deletions forward/v0.4/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://legacy.fatiando.org"/>
1 change: 1 addition & 0 deletions forward/v0.5/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="Refresh" content="0;url=https://legacy.fatiando.org"/>

0 comments on commit 4c4e681

Please sign in to comment.