Openlibrary: Fix HTML Validator issues on /subjects page

Created on 4 Oct 2020  路  8Comments  路  Source: internetarchive/openlibrary


Putting HTML code of /subjects endpoint in W3C HTML validator leads to errors. (Part of a bigger move to HTML 5)

Evidence / Screenshot (if possible)

Selection_004

Relevant url?

https://openlibrary.org/subjects

  • Environment (prod/dev/local)? prod

Related files


If #3878 gets accepted, it fixes the first two errors. Proof:
Selection_006

Since the code for the contentBody in /subjects is handled in the production database and we cannot modify it on our local instance using git, we have to take out the HTML from http://openlibrary.org/subjects.json, create a page on the local instance, correct it, and then send the whole HTML to whoever is leading this issue (I guess?) with a screenshot as a proof to show its working locally.

Stakeholders


@cdrini

@jdlrobson 3 Bug

Most helpful comment

Update: applied this change to the subject page.

https://validator.w3.org/nu/?doc=https%3A%2F%2Fopenlibrary.org%2Fsubjects

1 error remains - those will need changes in the codebase. THanks @Yashs911 for sorting this out!

All 8 comments

Again, should be merged with #2798

@jdlrobson I would like to work on this issue.

Since the code for the contentBody in /subjects is handled in the production database and we cannot modify it on our local instance using git, we have to take out the HTML from http://openlibrary.org/subjects.json, create a page on the local instance, correct it, and then send the whole HTML to whoever is leading this issue (I guess?) with a screenshot as a proof to show its working locally.

@jdlrobson so according to this we can't modify /subjects page using git.

Sorry @Yashs911 i'm not following you.

The HTML of http://localhost:8080/subjects can be generated just fine but you need to import it.

$ python scripts/copydocs.py "/subjects"

The HTML for that page can be piped into https://validator.w3.org/#validate_by_input

The reviewer (likely me) can verify the HTML is valid by the same approach and verify there are not UI regressions on the page locally.

Note for deployment: I guess Jeff Kaplan (the last editor), @cdrini or @mekarpeles or someone else with permission will be needed to upload the finalized and approved wiki content to https://openlibrary.org/subjects

We can link to gist of the content in this issue.

@jdlrobson https://github.com/internetarchive/openlibrary/pull/3878#issue-497163886 according to the 4th point in the description

The only error remaining is the Stray start tag script which the validator does not like is because the scripts in openlibrary/templates/site/footer.html are outside the tag. Since all the scripts are related to analytics and therefore belong before the HTML page ends, we can ignore this error.

Should I ignore this error?
And how should I send the HTML file?

@jdlrobson I have uploaded the HTML code here https://codepen.io/yashs911/pen/dypQBVM

Can you share the wikitext code so I can paste it into http://localhost:8080/subjects?m=edit ?

Should I ignore this error?

Feel free to file a patch against openlibrary/templates/site/footer.html

Update: applied this change to the subject page.

https://validator.w3.org/nu/?doc=https%3A%2F%2Fopenlibrary.org%2Fsubjects

1 error remains - those will need changes in the codebase. THanks @Yashs911 for sorting this out!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

BrittanyBunk picture BrittanyBunk  路  5Comments

BrittanyBunk picture BrittanyBunk  路  5Comments

BrittanyBunk picture BrittanyBunk  路  4Comments

Yashs911 picture Yashs911  路  5Comments

bitnapper picture bitnapper  路  4Comments