To Our Amazing Educators Everywhere,
Happy Teacher Appreciation Week!
Found this content helpful? Log in or sign up to leave a like!
Hello
Situation
We have several courses on Canvas. These courses have several pages which all contain a text string that needs removal.
Attempted solution
We exported course "something" which produces a "something.imscc" file which is a .zip file. We then unzipped it. Then we programatically removed all the strings that needed to be removed from the wiki_content folder files. After this we zipped it to the same name "somethings.imscc". Then we imported this file to the same course it was exported from. The hope was that this import would overwrite all the old html files with the new ones, however it just added duplicates of all the files, we then have the correct and the incorrect version of the same html page.
Question
Is there a way to export a course, do the editing needed to the html files in wiki_content and then import it to the same course and have it replace the old html files?
Solved! Go to Solution.
Hi @Andreasm,
Are the strings all in Canvas Pages, or are they in other areas like assignments, quizzes, etc too? Another way to approach this programmatically would be to use the Canvas API to get the HTML content page-by-page, then do a search/replace, and update the content. You could do this with your scripting/programming language of choice. I find python to handle the API with fairly minimal code.
If you think this could be a solution that would work for you and want any further info, please let me know!
-Chris
While it should be set up to overwrite existing pages, there could be something with how it is reading the edited files that could be causing it to duplicate instead.
If you are fixing this by editing the HTML to remove the text string, you can edit the HTML from within Canvas. If you know the exact pages that the text string is located on, even better. Go to the page needing removal of the string and enter the editing mode. Then click on the < > icon in the lower right below the editing pane to access the HTML editor. Now, there are two versions to the editor: Pretty and Raw. Once in the HTML editor, you can switch between them with a button on the left side below the editing pane. The Pretty version indents everything, but doing CTRL-F is limited to just what is visible plus a few extra lines. If you have a longer page, switch to the Raw editor and use CTRL-F to search for the string. Then remove the necessary part and save. Try this with one page you know has the content needing remove to see if you can find the necessary string to remove.
A benefit to this method is saving the steps of needing to export, unzip the .imscc file, edit files, rezip as an .imscc file, then import the file (and any necessary fixing of duplicates). Plus it means that you can now export a clean file with the issue fixed.
Thank you for replying!
I am aware of the solution on canvas itself, however this solution will be orders of magnitude slower than doing the solution I am aiming at. The string I want to remove is inside a table element in the first td(used for css), in the second lies the content, the table and string needs to be removed and the content in the second td preserved. Other strings just needs a rename but also have the same table setup. One of our courses have 744 of these tags, lets say that with the reload time on canvas and then manually finding and changing one tag takes about 30s, we are up to a little over 6 hours of work multiply this with around 25 courses and you have some really dreary work ahead of you. Programatically the change takes 2 seconds and the export and import time is not that huge a time cost, then we maybe have 5-10 minutes of work versus 6 hours of manual editing.
Holy cow. That is quite a bit of editing and I understand why you would want to do it offline if you can programmatically make the edits. That definitely clarifies the situation.
Unfortunately, considering that, I'm not sure of a way for you to prevent the duplicate pages with your current method. The only other thing I could think of doing would be to Reset the course (Settings menu) before importing the corrected content. However, that is not a good option if the class is already underway as that would wipe everything, including student work and grades. There is another possibility, but it would need to be tested and I've had haphazard results myself. You could try creating a blank course, then import that content into an existing course. Again, it should overwrite existing content. It even gives a warning about that when copying. However, I have found it does not always work and I sometimes get duplicates too. Sorry I cannot be more help. I will let others see if they might have a solution for you. I'll keep an eye on this thread as I am curious if you find a solution.
Hi @Andreasm,
Are the strings all in Canvas Pages, or are they in other areas like assignments, quizzes, etc too? Another way to approach this programmatically would be to use the Canvas API to get the HTML content page-by-page, then do a search/replace, and update the content. You could do this with your scripting/programming language of choice. I find python to handle the API with fairly minimal code.
If you think this could be a solution that would work for you and want any further info, please let me know!
-Chris
I believe all of these occurrences are in Canvas Pages. I will check out the possibility of resolving this with the use of the Canvas API!
Granted I resolve this I will post my solution here. Thanks!
To participate in the Instructure Community, you need to sign up or log in:
Sign In