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

new landing page (first page after opening gateway) with new tabs opening when clicking links #76

Open
ulno opened this issue Apr 20, 2024 · 13 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@ulno
Copy link
Contributor

ulno commented Apr 20, 2024

estimate [ulno]: 4h <- if doing more than fixing the links

@ulno ulno converted this from a draft issue Apr 20, 2024
@ulno ulno assigned Natomac and tonysln and unassigned tonysln Apr 21, 2024
@ulno ulno moved this from Backlog 🔜 to Todo 📝 in IoTempower Task Manager Apr 21, 2024
@ulno ulno added good first issue Good for newcomers enhancement New feature or request labels Apr 21, 2024
@mbz4
Copy link
Collaborator

mbz4 commented Apr 22, 2024

Potentially duplicate w/ #89?

@mbz4 mbz4 added the duplicate This issue or pull request already exists label Apr 22, 2024
@mbz4
Copy link
Collaborator

mbz4 commented Apr 22, 2024

Oh, this refers to when running web_starter and opening localhost:40080 in the browser, the page that displays - when clicking on links there, we would like those links to open a new tab instead of current tab + update/refresh landing page contents.

@mbz4 mbz4 removed the duplicate This issue or pull request already exists label Apr 22, 2024
@mbz4
Copy link
Collaborator

mbz4 commented Apr 22, 2024

@mbz4 mbz4 moved this from Todo 📝 to In Progress 🏗️ in IoTempower Task Manager Apr 22, 2024
@mbz4 mbz4 self-assigned this Apr 22, 2024
@mbz4
Copy link
Collaborator

mbz4 commented Apr 22, 2024

Image

Working on this next.
Added explicit header links to important tools.
Next, updating the links to open in new tab (hope it works w/ man pages too).

@mbz4 mbz4 moved this from In Progress 🏗️ to Todo 📝 in IoTempower Task Manager Apr 22, 2024
@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

So... we don't have direct control over attributes in Sphinx, like target="_blank"...

In order to configure links to open in a new tab in .rst docs we need to adjust Sphinx and use a custom JavaScript solution that automatically adds this attribute to external links when the HTML is loaded in the browser

Resources
---------

Product page: `M5Stack Stick C <https://shop.m5stack.com/products/stick-c?variant=43982750843137>`_
document.addEventListener('DOMContentLoaded', function() {
    var links = document.querySelectorAll('a[href]');
    links.forEach(function(link) {
        if (link.hostname !== window.location.hostname) {
            link.target = '_blank';
        }
    });
});

But this means that all links will open in a new tab.
@ulno would this be desirable behaviour?
I'm new to Sphinx so I'll explore this further...

@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

Testing this solution:

extensions = [
    "sphinx_new_tab_link",
]

But it wants this:

pip install sphinx-new-tab-link

More here: Guide of sphinx-new-tab-link

Learned about it from here: Stack Overflow: Add open-in-new-tab links in Sphinx/reStructuredText

@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

This worked out of the box. Navbar links behave the same.
@ulno not sure how to add this pip install to run automagically when installing iotempower...

@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

It doesn't feel that nice to have new tabs continually open...
and its inconsistent: some navbar links open in new tab some don't

@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

Having severe caching issues, suspect hidden symlinks to be the culprit:

Image

Image

Image

Image

In other news...
This line makes it possible to include custom .js and .css files and further customise the look and feel of the pages:

#html_static_path = ['_static']

@Natomac

@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

Resolved previous issue with hard cache clear.

New problem: when viewing on mobile, the little burger button does not work - no drop down or action... this means users have to switch to a desktop site to access navbar items.

Image

@mbz4
Copy link
Collaborator

mbz4 commented May 23, 2024

Looking into this too:
Image

@ulno
Copy link
Contributor Author

ulno commented May 24, 2024 via email

@mbz4
Copy link
Collaborator

mbz4 commented May 27, 2024

or we can try another site generator - VuePress maybe? (Vue)

or Docusaurus? (react; by Meta)

kinda like both but maybe docusaurus easier to work with?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
Status: Todo 📝
Development

No branches or pull requests

4 participants