Skip to content
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

Docs Homepage #23

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Docs Homepage #23

wants to merge 9 commits into from

Conversation

mwvd
Copy link
Contributor

@mwvd mwvd commented Nov 5, 2024

Docs homepage updates

This PR adds a refreshed homepage to the documentation site

Changes

  • Raw HTML added to render in core/index.rst
    • Inlined CSS
    • Homepage specific style override
      • Hides the sphinx generated page header for core/index.rst
      • Override style added to shared/_static/home.css
  • Images added to core/_static/assets/home

Notes

Reusable sections in raw generated HTML here could possibly also be automated with Javascript:

Note

In this example I moved image assets from core/_static/assets/home into core/_static/home/assets
(see core/_static/home/data.json below)

core/index.rst:
<!-- ... -->
<body>
  <div class="container" id="container">
    <h1 class="hx">Tenstorrent<br/>Documentation</h1>
    <!-- sections appended here -->
  </div>
  <script async>
    const main = async () => {
      const container = document.getElementById("container");

      const response = await fetch("_static/data.json");
      const sections = await response.json();

      sections.forEach((section) => {
        const sectionElement = document.createElement("div");
        sectionElement.classList.add("section");

        const sectionTitle = document.createElement("h2");
        sectionTitle.textContent = section.title;
        sectionElement.appendChild(sectionTitle);

        const grid = document.createElement("div");
        grid.classList.add("grid");
        sectionElement.appendChild(grid);

        section.cards.forEach((card) => {
          const cardElement = document.createElement("a");
          cardElement.href = card.url;
          if (card.url.startsWith("http")) {
            cardElement.target = "_blank";
          }
          cardElement.classList.add("card");
          if (card.small) {
            cardElement.classList.add("small-card");
          }

          const image = document.createElement("img");
          image.src = card.image;
          cardElement.appendChild(image);

          const title = document.createElement(card.small ? "h4" : "h3");
          title.textContent = card.title;
          cardElement.appendChild(title);

          grid.appendChild(cardElement);
        });

        container.appendChild(sectionElement);
      });
    }
    main();
  </script>
</body>
<!-- ... -->
core/_static/home/data.json:
[
  {
    "title": "Add-in Boards",
    "cards": [
      {
        "title": "Grayskull™",
        "image": "_static/home/grayskull.png",
        "url": "aibs/grayskull.html"
      },
      {
        "title": "Wormhole™",
        "image": "_static/home/wormhole.png",
        "url": "aibs/wormhole.html"
      },
      {
        "title": "Warp 100 Bridge",
        "image": "_static/home/warp-100-bridge.png",
        "url": "aibs/ack.html",
        "small": true
      },
      {
        "title": "Active Cooling Kit",
        "image": "_static/home/active-cooling-kit.png",
        "url": "aibs/warp100.html",
        "small": true
      }
    ]
  },
  {
    "title": "Systems",
    "cards": [
      {
        "title": "TT-QuietBox",
        "image": "_static/home/tt-quietbox.png",
        "url": "systems/quietbox.html"
      },
      {
        "title": "TT-LoudBox",
        "image": "_static/home/tt-loudbox.png",
        "url": "systems/t3000.html"
      },
      {
        "title": "T7000",
        "image": "_static/home/t7000.png",
        "url": "systems/t7000.html",
        "small": true
      },
      {
        "title": "T1000",
        "image": "_static/home/t1000.png",
        "url": "systems/t1000.html",
        "small": true
      }
    ]
  },
  {
    "title": "Software",
    "cards": [
      {
        "title": "TT-NN",
        "image": "_static/home/tt-nn.png",
        "url": "https://tenstorrent.github.io/ttnn/latest/index.html",
        "small": true
      },
      {
        "title": "TT-Buda™",
        "image": "_static/home/tt-buda.png",
        "url": "https://tenstorrent.github.io/pybuda/latest/index.html",
        "small": true
      },
      {
        "title": "TT-Metalium™",
        "image": "_static/home/tt-metalium.png",
        "url": "https://tenstorrent.github.io/tt-metalium/latest/index.html",
        "small": true
      },
      {
        "title": "Software/Utilities",
        "image": "_static/home/software-utilities.png",
        "url": "https://tenstorrent.github.io/syseng/latest/index.html",
        "small": true
      },
      {
        "title": "TT-MLIR",
        "image": "_static/home/tt-mlir.png",
        "url": "https://docs.tenstorrent.com/tt-mlir/",
        "small": true
      }
    ]
  },
  {
    "title": "Support",
    "cards": [
      {
        "title": "FAQ",
        "image": "_static/home/faq.png",
        "url": "https://tenstorrent.com/faq",
        "small": true
      },
      {
        "title": "Compliance",
        "image": "_static/home/compliance.png",
        "url": "support/README.html",
        "small": true
      },
      {
        "title": "Contact Us",
        "image": "_static/home/contact-us.png",
        "url": "https://tenstorrent.com/contact",
        "small": true
      }
    ]
  },
  {
    "title": "All Documentation",
    "cards": []
  }
]

This approach is probably easier to maintain long-term, but I don't really like the idea of introducing client-side rendering to a docs site, especially when it's async (sections could be inline JS and we could drop the async, but then it's not quickly openable from a code editor). I'm open to other thoughts here.

Screenshots

Screenshot 2024-11-05 at 11 49 31 AM
Screenshot 2024-11-05 at 11 49 43 AM
Screenshot 2024-11-05 at 11 50 04 AM
Screenshot 2024-11-05 at 11 50 13 AM
Screenshot 2024-11-05 at 11 50 30 AM

@dimitri-tenstorrent
Copy link
Contributor

@mwvd I have deployed this version onto staging here https://tenstorrent-docs-test.github.io/

One of the new changes the team requested is a prominent Getting Started section on the new homepage. The new getting started section is here - https://tenstorrent-docs-test.github.io/quickstart.html

Also, we decided to remove software/utilities box as it was conflicting with the instructions from Getting Started.

Copy link
Contributor

@dimitri-tenstorrent dimitri-tenstorrent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 👍

@@ -1,6 +1,256 @@
Tenstorrent
==============================

.. raw:: html
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use :include: tag here and have the HTML inside of home.html?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes- much better idea- I'll do this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't figure this out with :include:, but was able to move the HTML into /core/_templates/home.html and then include it here with:

.. raw:: html
   :file: _templates/home.html

Hides sphinx generated homepage header (https://docs.tenstorrent.com/)
*/

#tenstorrent > h1 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I not remove it via deleting the first two lines of index.rst

Tenstorrent
==============================

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tenstorrent
==============================

Removing this seems to make the page title default to the closest header:

Screenshot 2024-11-25 at 10 56 50 AM

@mwvd
Copy link
Contributor Author

mwvd commented Nov 18, 2024

@dimitri-tenstorrent seems like the staging build is missing everything below the "All Documentation" header:

image

Is this just because of config handling orchestration for staging? Or would this be the same in the production environment also

@mwvd
Copy link
Contributor Author

mwvd commented Nov 18, 2024

One of the new changes the team requested is a prominent Getting Started section on the new homepage. The new getting started section is here - https://tenstorrent-docs-test.github.io/quickstart.html

I'll talk to Keith about this tomorrow and aim for EOW in another PR

Also, we decided to remove software/utilities box as it was conflicting with the instructions from Getting Started.

@dimitri-tenstorrent
Copy link
Contributor

@dimitri-tenstorrent seems like the staging build is missing everything below the "All Documentation" header:

image

Is this just because of config handling orchestration for staging? Or would this be the same in the production environment also

Ah, the table of contents was hidden in the last version, but I can re-add it to this one.

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.

2 participants