-
Notifications
You must be signed in to change notification settings - Fork 10
[FEAT] Redirect generator based on git changes. #989
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
Conversation
Thanks a lot, this patch is magic! I just tried it out and it detected the redirects just fine. I think we would need an additional parameter to tell the command which versions have to be created. we frequently have redirects like
The other question would be how we can get the first part of the domain. We could, theoretically get it from the composer name (typo3/tutorial-getting-started) and composer type mapping. |
I added a commit with which you can make the version regex and path configurable. Usage: docker run -i --rm --user 1000 -v${PWD}:/project typo3-docs:local create-redirects-from-git -b 192fc31 -r "(main|13.4)" -p '/m/typo3/reference-coreapi/' |
@jaapio, what would be needed to proceed here? |
I think we need to validate the output, and see how we can integrate this in your workflow. |
Yes, I tried it locally and improved the links so that they work |
Let's first finish this PR by making the pipeline pass and add some tests to validated the code works as expected. If this works and helps to generate the redirects, let's see how we can integrate this. I do see the option to run the command every time we render a documentation project. And send the output as a commit to the correct repository. So we can maintain a file per documentation project. That would allow us to render every redirect we find in the git history from now on. As nginx loads the config on reload there is nearly any impact on the number of files it needs to include. And splitting the files makes it easier to review what happens. Rather than to maintain one large file. |
d17e773
to
8f10bd6
Compare
@jaapio the pipeline is passing, however I am not sure how to write tests for this |
Cool, let us test this manually! |
This is a prove of concept PR, showcasing how we could possibly generate a list of redirects. This is not complete and should be evaluated carefully.
The purpose of the new command is to be able to automatically create directs for file that have been removed. For now we only use the git history, but we might want to expand this. For example to use the perma links used within most documentation.
To test this command you have to build the docker file for your local development. Using
make docker-build
.After that the command can be tested on you local machine.
Where
3eb3cfc
is a short sha of the project you are processing. In my example I used: https://github.com/TYPO3-Documentation/TYPO3CMS-Guide-HowToDocumentThe output of the command is now written to a file:
redirects.nginx.conf
This is just a real quick showcase, we could implement this for example in the github action, to automatically create a pr or issue to publish the content.