elixirschool / school_house

The new era of Elixir School now powered by @phoenixframework

Home Page:https://elixirschool.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Duplicate IDs in table of contents

jaimeiniesta opened this issue Β· comments

There are some duplicate IDs generated by the table of contents for the lessons:

https://rocketvalidator.com/s/0bdee490-cff7-495a-95a3-40211cd2b5cd/i?search=duplicate+ID

For example, in https://beta.elixirschool.com/en/ecto/associations there are 2 sections titled "Many to Many":

  • Types of Associations > Many To Many
  • Saving Associated Data > Many To Many

Captura de pantalla 2021-07-25 a las 18 45 44

Clicking on those will always get you to the first one, as the second is a duplicate.

In order to fix this we need to give a unique ID to each section. I'm not sure how to do that, maybe including numbers, like:

  1. Set Up
  2. Types of Associations
    2.1 Belongs To/Has Many
    2.2.1 The Has Many Migration
    2.2.1 The Has Many Schema

...

I'd be interested in this if it's still up for grabs.

How are the ids generated now for the lessons?

Totally up for grabs!

The ids are generated in the content/lesson.ex file by the link_fragment/1 function. Essentially, as the table of contents is built, the link_fragment/1 function accepts the section name and generates an id to use in the link to the section. The same id is ultimately used in the _section_header.html.eex template.

If you have any questions or want more clarification, let me know and thanks for taking a stab at this 🎊

I've just checked and this issue is now fixed! πŸš€

Thank you @vclayton πŸ‘ πŸ‘ πŸ‘