Skip to content

Fix redirects #283

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

Merged
merged 17 commits into from
May 30, 2023
Merged

Fix redirects #283

merged 17 commits into from
May 30, 2023

Conversation

henilp105
Copy link
Member

@henilp105 henilp105 commented May 22, 2023

This PR is to resolve #222 , Please refer : https://fortran-lang.discourse.group/t/4942

I have shifted the en/ to root directory and set the language redirections for other languages.

This is a permant patch to fix the bing as it seems the most likely cause could be HTML redirection , as we don't have the functionality to add 301 Redirect in gh-pages, thus this PR is a permanant fix to this redirection bug , and this same method of redirection is also used in the fpm-docs repository and we seem to reproduce the same problem for the fpm-docs repository as well.

Thanks and Regards,
Henil

CC @awvwgk @certik

@henilp105 henilp105 requested review from awvwgk and certik May 22, 2023 09:13
@henilp105
Copy link
Member Author

#build_preview

@github-actions
Copy link

This PR has been built with Sphinx and can be previewed at: https://fortran-lang.github.io/webpage/pr/283

@certik
Copy link
Member

certik commented May 23, 2023

The build preview says 404. How can I check that this PR works? Probably locally. I will have time tomorrow to look into this.

@henilp105
Copy link
Member Author

@certik it is due to the preview build restrictions you can checkout it here : https://fortran-lang.org/pr/283/en/ . it would be great if you could test it locally. Thanks.

@certik
Copy link
Member

certik commented May 23, 2023

I build it using the instructions in the README and when I go to the webpage, I can see:

Screen Shot 2023-05-23 at 3 12 53 PM

If I click on a given language, then everything works. But shouldn't I see the English version at the root link?

@certik
Copy link
Member

certik commented May 23, 2023

I think you move things around in the workflow. How about you create a script that you call from the CI, that we can also run locally? Then we can test it that everything works.

@awvwgk
Copy link
Member

awvwgk commented May 23, 2023

I recommend to directly change this in the build.py script rather than the CI workflow:

diff --git a/build.py b/build.py
index 9e50d513b..41652158e 100644
--- a/build.py
+++ b/build.py
@@ -62,7 +62,7 @@ If you are not redirected automatically, follow the <a href='{0}'>link</a>.
 """
 
 
-def build_docs(language: str) -> None:
+def build_docs(language: str, root: bool) -> None:
     """
     Build the documentation for a single language.
 
@@ -78,7 +78,7 @@ def build_docs(language: str) -> None:
             "-b",
             "dirhtml",
             str(srcdir),
-            str(outdir / language),
+            str(outdir) if root else str(outdir / language),
             f"-Dlanguage={language}",
         ],
         cwd=root,
@@ -119,11 +119,11 @@ def build_all(redirects: Dict[str, str], languages: List[str]) -> None:
         List of languages to build the documentation for.
     """
 
-    for language in languages:
-        build_docs(language)
-
     build_redirects(redirects, languages[0])
 
+    for language in languages:
+        build_docs(language, language == languages[0])
+
 
 if __name__ == "__main__":

@certik
Copy link
Member

certik commented May 23, 2023

@henilp105 go ahead and do the change that @awvwgk suggested. Then ping me, I'll test it again locally.

@henilp105
Copy link
Member Author

Sure, @certik I have made the changes , can you please test it locally ?

@henilp105
Copy link
Member Author

The Preview of the PR: https://henilp105.github.io/webpage/

@awvwgk awvwgk merged commit 393bbc9 into fortran-lang:main May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate sitemap.xml for crawlers
3 participants