Skip to content

Conversation

fonsp
Copy link
Member

@fonsp fonsp commented Nov 23, 2021

In this rewrite, the entire process to generate the site will be done by one script (written as a Pluto notebook, of course), instead of a combination of manual scripts, CI Julia scripts and Franklin. Right now it doesn't use Franklin at all anymore, but I might add back Franklin to process markdown files.

This makes it easier to set up a fork of the website, since the whole system now uses the same book_model.json file as input (describing the list of notebooks in the sidebar).

The notebook to generate the site can also be used to run and test it locally, and this local version now includes HTML exports of notebooks (before, you had to trust that the github CI would work properly) and can partially update automatically. It will be easy to add local support for the slider server later.

Eventually, the hope is that you can edit the course page by directly editing the sidebar on the left. That will probably be a separate project

Try it

Update Pluto and run the notebook in newwebsite/generate.jl.

Comment on lines 180 to 184
notebook_name =
basename(without_pluto_file_extension(section.notebook_path))
@htl("""
<a class="sidebar-nav-item {{ispage /$notebook_name/}}active{{end}}" href="/$notebook_name/"><b>$(chapter_number).$(section_number)</b> - <em>$(section.name)</em></a>
""")
Copy link

Choose a reason for hiding this comment

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

Suggested change
notebook_name =
basename(without_pluto_file_extension(section.notebook_path))
@htl("""
<a class="sidebar-nav-item {{ispage /$notebook_name/}}active{{end}}" href="/$notebook_name/"><b>$(chapter_number).$(section_number)</b> - <em>$(section.name)</em></a>
""")
notebook_name =
basename(without_pluto_file_extension(section.notebook_path))
notebook_id = flatten_path(without_pluto_file_extension(section.notebook_path))
@htl("""
<a class="sidebar-nav-item {{ispage /$notebook_name/}}active{{end}}" href="/$notebook_id/"><b>$(chapter_number).$(section_number)</b> - <em>$(section.name)</em></a>
""")

Copy link

Choose a reason for hiding this comment

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

some explanation, since there doesn't seem to be highlighting of changed words:

This fixes links to notebooks in the sidebar.

It uses notebook_id instead of notebook_name for the href. notebook_id is the name you assign to the build of the notebooks, e.g. notebooks_week3_newton_method.

@greimel

This comment was marked as outdated.

@greimel

This comment was marked as outdated.

@likanzhan
Copy link

likanzhan commented Feb 12, 2022

Error encountered when trying to play with the branch. Should I update the versions of the packages?

@dougie-r2
Copy link

This question sounds bit stupid. Should I use all the materials in newwebsite folder? I've tried open the generate.jl file in Pluto and got bunch of errors.

@greimel
Copy link

greimel commented Feb 12, 2022

@delphinH @likanzhan The code in https://github.com/greimel/18S191-reduced should work fine.

Instructions

  1. Put your notebooks in the notebooks/ folder
  2. update newwebsite/book_model_small.json
  3. Put any pure md files in website/
  4. Run the newwebsite/generate.jl notebook in Pluto

The code should work fine for local preview and deployment on github pages.

@fonsp I think the code in my fork is pretty much ready to be turned into a template repo. I am hesitant to set it up myself, since it is essentially your code. How do you suggest to proceed?

@likanzhan
Copy link

Thanks, @greimel, that would be great.

When I run the the template you reduced, I got the following error

Screen Shot 2022-02-13 at 10 39 36 AM

It seems that the version of PlutoSliderServer in the newwebsite project is outdated.

My question is is there a specifically reason we continue use the old format of Pluto, i.e., using Pkg.activate("."); Pkg.instantiate(), rather than using using ... (the modern way of using Pluto) directly ?

If we need to stick to the old mode, my second question is should I update the versions of Pluto and PlutoSliderServer in the newwebsite project or is there some other way so I can correct the error?

Thanks.

Likan

@greimel
Copy link

greimel commented Feb 13, 2022

I don't think that this would make a difference, since the manifest has been added to the repo.

Probably there are Pkg server issues?

@greimel
Copy link

greimel commented Feb 14, 2022

I turned this PR into a template repository (see the website this template generates)

Instructions (see also the README in the template repo)

  1. Put your notebooks in the notebooks/ folder
  2. update newwebsite/book_model_small.json
  3. Put any pure md files in website/
  4. Run the newwebsite/generate.jl notebook in Pluto

The code should work fine for local preview and deployment on github pages.

@fonsp fonsp force-pushed the nov-2021-refactor-1 branch from 157ce27 to 5010d76 Compare February 16, 2022 11:52
@fonsp fonsp mentioned this pull request Nov 1, 2022
@fonsp
Copy link
Member Author

fonsp commented Nov 1, 2022

Superseded by #124

@fonsp fonsp closed this Nov 1, 2022
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.

4 participants