Skip to content

Complete Redesign of the Installation Page #51

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

Merged
merged 2 commits into from
Sep 16, 2021

Conversation

Fatih20
Copy link
Contributor

@Fatih20 Fatih20 commented Aug 14, 2021

Continuation of #50

To do:

  • Use overrides to remove the pesky footer at the bottom and pencil tool at the header, without losing markdown extension that is used for generating tabs.
  • Correct the way that the individual OS' installation page links to other OS's installation page
  • Investigate why the variables in extras isn't read by the installation overrides

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 14, 2021

2021-08-14.19-56-49.mp4

The site as of right now.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 15, 2021

I've looked into the macros plugin and from what I've tried, it is possible to include markdown files in HTML files. The problem now is that the documentation doesn't seem to mention a way to include just part of the included markdown files. But that would mean every time I'm using a new tag, a new markdown file is required (assuming if we want to sanitize the markdown file from HTML syntax).

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 15, 2021

@Technius can you elaborate further on how we are going to make overrides but still having the content in the markdown files? Because I don't really understand.

@Technius
Copy link
Member

Technius commented Aug 15, 2021

We create an override for installation/. This override should contain the common elements, like the markup for the buttons at the top. We can select which button is "active" by reading metadata from the markdown files (e.g., at the top of the Windows file, we can set active_button: windows and then using if/else to determine which button should get the active class). To include the markdown content, we can use the page.content variable.

The individual markdown files should have the OS-specific instructions. In this case, the markdown files should just contain the contents of the installation-guide div.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 15, 2021

Here's thing though. I'm assuming making the overrides for the installation page is the same process as making the overrides for the homepage. I repeated the process of moving the file to an HTML to the overrides folder with all of its CSS. For some reason, the page wouldn't read the CSS and go about unstyled. Even weirder is that the table of content is still visible even though we're supposed to override the theme. This didn't happen with the homepage.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 16, 2021

We create an override for installation/. This override should contain the common elements, like the markup for the buttons at the top. We can select which button is "active" by reading metadata from the markdown files (e.g., at the top of the Windows file, we can set active_button: windows and then using if/else to determine which button should get the active class). To include the markdown content, we can use the page.content variable.

The individual markdown files should have the OS-specific instructions. In this case, the markdown files should just contain the contents of the installation-guide div.

Wouldn't this mean clicking the OS selection button wouldn't link to the OS page? So is it replaced with an if/else logic that select which content is displayed according to what button is "active"? But what happens when there is no active button, such as when the user first visit the installation page?

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 16, 2021

On a second thought, could simplifying the override be a part of a different PR? Considering that some part are more complex to simplify and optimize, (Linux installation page has different download buttons, and the title of the version selection has a subtitle that isn't present in Windows and MacOS installation page), for the best implementation I think it should be a different PR.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 16, 2021

image

For some reason that I don't know, MkDocs just wouldn't read the CSS linked to the installation.html. <style> still works, for some reason. The only reason it is being somewhat styled is the CSS from the /docs/css directory. If they are removed (which they should because they're specific to the installation page), it'll be like this.
image

Even worse is that for some reason, the table of content is still present. The homepage didn't do any of this in my previous pull request.

@Technius
Copy link
Member

Yeah, let's just keep it simple for now. I can help you clean it up in another PR.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 25, 2021

Alright, that problem is fixed. But now when building, MkDocs says that 'downloads' (which is in the individual OS installation page) is undefined. Even though it is defined in the .yml file. Any help? @Technius

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 25, 2021

I added the whole downloads variable to the header of the markdown only as a temporary measure. Once the layout is corrected I'll fix it.

@Technius
Copy link
Member

You'll probably need to resort to the markdown file for Linux, otherwise you'll have to enter <code> tags manually.

I added the whole downloads variable to the header of the markdown only as a temporary measure.

For the links, the "correct" solution would probably be something like defining the links in a yml file and then including it with a macro: https://mkdocs-macros-plugin.readthedocs.io/en/latest/advanced/#including-external-yaml-files

@Technius
Copy link
Member

The issue seems to be that markdown can't be used inside of manually inserted HTML tags. The simplest workaround I can think of is to put the tab element thing (the one that contains all of the tabs) into a markdown file and then use the include macro.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 25, 2021

The issue seems to be that markdown can't be used inside of manually inserted HTML tags. The simplest workaround I can think of is to put the tab element thing (the one that contains all of the tabs) into a markdown file and then use the include macro.

I've done this. Now I just need to theme it.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 25, 2021

I don't get why using {{ ' ../linux' | url }} in the Windows installation page to link to the Linux installation page links to http://127.0.0.1:8000/linux. Shouldn't it go up a directory and then go to linux? Why is it not using relative path?

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 26, 2021

Even after including the many downloads variable in an external yaml file, the issue still persists.

ERROR    -  Error building page 'installation/linux.md': 'dict object' has no attribute 'downloads'
Traceback (most recent call last):
  File "/home/fatih/.local/bin/mkdocs", line 8, in <module>
    sys.exit(cli())
  File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/fatih/.local/lib/python3.8/site-packages/mkdocs/__main__.py", line 173, in serve_command
    serve.serve(dev_addr=dev_addr, livereload=livereload, **kwargs)
  File "/home/fatih/.local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 54, in serve
    config = builder()
  File "/home/fatih/.local/lib/python3.8/site-packages/mkdocs/commands/serve.py", line 49, in builder
    build(config, live_server=live_server, dirty=dirty)
  File "/home/fatih/.local/lib/python3.8/site-packages/mkdocs/commands/build.py", line 306, in build
    _build_page(file.page, config, doc_files, nav, env, dirty)
  File "/home/fatih/.local/lib/python3.8/site-packages/mkdocs/commands/build.py", line 217, in _build_page
    output = template.render(context)
  File "/usr/lib/python3/dist-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/lib/python3/dist-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "/home/fatih/Documents/Github Stuff/Xournal Site/Better Installation Page/overrides/installation/linux.html", line 1, in <module>
    {% extends "base.html" %}
  File "/home/fatih/.local/lib/python3.8/site-packages/material/base.html", line 121, in <module>
    {% block tabs %}
  File "/home/fatih/Documents/Github Stuff/Xournal Site/Better Installation Page/overrides/installation/linux.html", line 31, in <module>
    <a class="download button download-linux" href="{{page.meta.downloads.linux.appimage}}">AppImage</a>
  File "/usr/lib/python3/dist-packages/jinja2/environment.py", line 430, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'dict object' has no attribute 'downloads'

@Technius
Copy link
Member

Technius commented Aug 27, 2021

The tabs display correctly for me; did you restart your server?

Unfortunately, it seems like macros only work in markdown files, not in templates (fralau/mkdocs-macros-plugin#60 (comment)).

Let's just do the metadata at the top of the page for now. I will clean it up later.

@Technius
Copy link
Member

By the way, I'm not sure that we need the extra downloads.yml file. Aren't the download links already defined in the extras section of mkdocs.yml?

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 27, 2021

The tabs display correctly for me; did you restart your server?

It's been correct since yesterday. I just had to break it up to a separate markdown file.

By the way, I'm not sure that we need the extra downloads.yml file. Aren't the download links already defined in the extras section of mkdocs.yml?

It is. But I thought I had to try breaking it up into another file, that's what the link you sent was about.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 28, 2021

While this doesn't mitigate the problem completely, I believe this is a more elegant stopgap solution than merely putting the links in the header of the markdown. @Technius

@Technius
Copy link
Member

Let's just get something working for now. I will clean it up later.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 29, 2021

Let's just get something working for now. I will clean it up later.

It's already working. Have you not tried it?

@Technius
Copy link
Member

The install pages look fine to me for now.

I don't get why using {{ ' ../linux' | url }} in the Windows installation page to link to the Linux installation page links to http://127.0.0.1:8000/linux. Shouldn't it go up a directory and then go to linux? Why is it not using relative path?

I think this is a mkdocs bug; the url filter should be generating the linux relative to the current page, but it's generating the link relative to the site's base url instead. For now, let's just directly write the url instead of using the filter.

@Fatih20
Copy link
Contributor Author

Fatih20 commented Aug 29, 2021

Done.

Copy link
Member

@Technius Technius left a comment

Choose a reason for hiding this comment

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

I think this is good to go. I will handle the squash and final merge.

@Technius Technius linked an issue Sep 16, 2021 that may be closed by this pull request
This is a combination of 11 commits:

* Most redesign of the page is done

* Purge h1 for SEO optimization

* Fix the installation.html not reading CSS files

* Add CSS properties that were previously covered by the themes

* Fix theming on tabs and automating its content

* Make download button be vertically-aligned between the Nightly and Stable version so that it's more aesthetically pleasing

* Removes unnecessary padding

* Fix links to other OS installation pages with absolute path

* Tweaks the tab in linux installation page by lighting up the color of not selected distro and giving animation to the colored underline

* Put links as a variable in a markdown file that then get included in the HTML

* Change links to not use the filter
@Technius Technius force-pushed the Installation-page-redesign branch from 78c63b9 to a1233ba Compare September 16, 2021 01:36
@Technius Technius merged commit c077d03 into xournalpp:site Sep 16, 2021
@Technius
Copy link
Member

Sorry it took so long, I've been busy recently.

@Technius
Copy link
Member

I pushed some commits to master branch to refactor the installation page template code. Some minor visual changes happened; can you check to see if it looks okay?

@Fatih20
Copy link
Contributor Author

Fatih20 commented Sep 18, 2021

I pushed some commits to master branch to refactor the installation page template code. Some minor visual changes happened; can you check to see if it looks okay?

Just saw it. Can't find any difference.

@Technius
Copy link
Member

Thanks for checking!

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.

Better Installation Page
2 participants