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

[associated vote ended on 2023-03-30] Static site generator for the Ansible community web presence #210

Closed
13 tasks
oraNod opened this issue Mar 9, 2023 · 28 comments

Comments

@oraNod
Copy link

oraNod commented Mar 9, 2023

Summary

The Ansible community is requested to provide input on requirements and options for a static site generator that will create a new Ansible community site and Ansible community documentation navigation should the Ansible community be in favour of those efforts.

Additional Information

Here is the initial list of requirements and things that would be nice to have. We can evaluate SSG options against this list:

Requirements:

  • Ease of deployment (fast to build html, can put into gh action, low risk of breakage when upgrading)
  • Custom landing page (ability to create landing page that is not "documentation layout")
  • Base templates and themes for rapid prototyping
  • Easily add custom css when required but low requirement for theme customization, built-in cross-browser compatibility and responsive design
  • Write content in md or rst
  • Button to edit pages directly
  • Blog capabilities
  • Basic search functionality
  • Well maintained project with recent commits
  • i18n (content renders correctly for everyone)
  • Media support (embedding YouTube videos)

Nice to have:

  • Python extensibility / integration
  • Ability to extend templates and themes with Jinja
@oraNod
Copy link
Author

oraNod commented Mar 9, 2023

@leogallego
Copy link
Contributor

@oraNod is the "web ui for content generation" included in the "cms" concept?
I would like to add that to the nice-to-have if possible!

@mariolenz
Copy link
Contributor

I don't know anything about static site generators... but doesn't antsibull-docs already use sphinx? If it fulfills the requirements (and maybe even the nice-to-haves) maybe that would be a reason to use it for the new Ansible community site?

Just an idea. As I've said, this isn't really my area of expertise.

@gotmax23
Copy link
Contributor

gotmax23 commented Mar 9, 2023

Hugo is written in Go instead of Python, but it's also a good choice and has a strong community surrounding it.

@gotmax23
Copy link
Contributor

gotmax23 commented Mar 9, 2023

I don't think mkdocs or Sphinx are good choices for a landing page. They're meant for documentation, and we already have a docsite.

@mscherer
Copy link

mscherer commented Mar 9, 2023

As it was asked on the chat, I kinda feel I can give some opinions here (and I try to keep myself out of tooling discussion, because obviously, everybody but me is always wrong :p ) .

My team at RH had to deal with SSG in the past 7 years, and I also evaluated them myself for personal projects, so my perspective is more from deployment side than designer side.

I think extensibility can be a trap. I know there is always tradeoff on features vs maintenability, and having plugins/modules/whatever is a way to solve that tension. However, my experience with Middleman (or Wordpress for that matter) is that plugins tend to get unmaintained, and cause troubles down the line. SSG also tend to get newer release, some changing their internal, resulting in breakage in plugins. Given SSG with plugins also tend to be written in dynamic languages, there is usually no clear interface or proper API, and there isn't a good curated marketplace like we have with linux distro.

So I would suggest, if there is a need for plugins, to treat them as proper software projects (eg, separate repo, CI, etc), and be evaluated as such (and the same caution to creating your own). In a ideal world, you want to avoid code as much as possible.

Another lesson I learned is that it can be nice to have a CI and tests for a website. For example, I use zola for my personal projects, and I stumbled upon a few issues upon update that were silently breaking the site and my templates (I tracked down to a refactoring in zola, and I was able to quickly correct, but I didn't detect at first ).

I tend to be partial toward static binary for SSG because 1) they are fast 2) they are easier to install/deploy/maintain, both desirable properties to ease contributions (and ease sysadmin life, which, as a sysadmin, is a high priority).

However, that tend to come with 1) no extensibility (again, a plus on my book)
2) no jinja (at best, a jinja-like system), so I suspect it might be a big "no" due to that.

When I say fast, that's around 10 seconds from commit being pushed to page on the web, for stage + prod, vs 4 to 5 minutes of a site of the same complexity based on middleman (due to the dynamic nature meaning we have to install plugins at each run ).

And static binary also help a lot for the versioning requirements, since you can just keep the old binary to build the old branch.

One approach that I tried to push for Fedora is that for some websites, it is also ok to treat them as disposable. Each time we had a new community manager for a project in my team, they changed the whole website, usually changing the stack (going from dynamic to static, or static to dynamic, from plain html to hugo to middleman to nico, etc). So there was no need to plan for long term support, since in 3 to 4 years time, everything would be throw away anyway.

Now, that's not the case for documentation, but for a isolated website (like a event one), treating the website as a temporary one where one can experiment with a different stack can be useful to get experience. I wrote about that idea on Fedora discourse, if you want to see the discussion (and others points made by others). The Fedora folks who work on that would surely be happy to discuss their experience.

So maybe not unifying docs + community + others can be used to get more experience with various SSGs stacks and avoid long term headaches of having too much requirements on 1 single stack.

@oraNod
Copy link
Author

oraNod commented Mar 9, 2023

I don't know anything about static site generators... but doesn't antsibull-docs already use sphinx? If it fulfills the requirements (and maybe even the nice-to-haves) maybe that would be a reason to use it for the new Ansible community site?

Just an idea. As I've said, this isn't really my area of expertise.

@mariolenz Yes I think Sphinx is a pretty solid choice because it has a lot of mindshare/adoption already. I'm not 100% on how well it does general sites, even though I'm pretty sure it has that capability.

@oraNod
Copy link
Author

oraNod commented Mar 9, 2023

Hugo is written in Go instead of Python, but it's also a good choice and has a strong community surrounding it.

@gotmax23 I can add Hugo to the list. I don't think it will have the "mindshare" with the community though. For instance I didn't include Jekyll as an SSG option because Ruby just wouldn't be a popular choice.

@oraNod
Copy link
Author

oraNod commented Mar 9, 2023

@mscherer Thank you so much for those valuable insights. I feel like there are a lot of things we can learn from the Fedora community here and you've raised a lot of points already that I'm not sure we've fully considered. Let me ask folks on the Ansible community team here but I think we should definitely meet with some of the Fedora folks about the experiences so we can bring those things over to this effort.

@oraNod oraNod changed the title Static site generator Static site generator for the Ansible community web presence Mar 10, 2023
@ssbarnea
Copy link
Member

@gotmax23 Take a look at Material landing page from https://squidfunk.github.io/mkdocs-material/ which does not really look as a "documentation landing" page. AFAIK, mkdocs-material can be used to also create custom landing pages.

@felixfontein
Copy link
Contributor

felixfontein commented Mar 15, 2023

I personally like Nikola a lot (https://github.com/getnikola/nikola/), I've been using it for a long time now (almost as long as Ansible) and it worked well for my personal homepages and blogs.

Simliar to ansible-core it has a small core that is extensible, and comes with plugins for everything - most things you need are already bundled, and then there's also https://themes.getnikola.com/ for more themes and https://plugins.getnikola.com/ for more plugins.

Nikola has been very stable in the several past years, so no big breaking changes are to be expected most of the time even if we write our own plugins.

  • Ease of deployment: Run nikola build and upload the result.

  • Write content in md or rst: Nikola has plugins for both formats (and more)

  • Built-in cross-browser compability and responsive design: Depends on the theme, but default themes have that as well

  • Blog capabilities: Nikola can do both pages and blog posts, and both can appear in the same Nikola site

  • Built-in templates and themes for rapid prototyping

  • Ability to extend templates and themes with Jinja: There are two templating plugins, jinja2 and mako; the default theme uses mako, but there's also a version of the default theme that uses jinja2

  • Well maintained project with recent commits

  • i18n: i18n support is natively included and works well

  • Mindshare within the broader Ansible community: I'm not sure what this really means

  • Python extensibility / integration

  • Sass to css compiler: present as a plugin (I'm using that for my sites)

  • Search: There is a plugin (https://plugins.getnikola.com/v7/localsearch/) for Tipue Search, but that doesn't seem to exist anymore (tipue.com is now ... something else). It should be possible to write a simple plugin that supports other (local or online) search engines

  • Analytics: depends on what kind of Analytics you want to use. It's a flexible static site generator, so you can include whatever you want.

  • Discourse integration / plugin: doesn't have a plugin yet (that I'm aware of), but it should not be a problem to add that. For me the main question is: what does "Discourse integration" mean? Use it for blog post comments? Something else?

  • Content management system / web ui for content creation, editing: There was a project for that, but it never got traction and is now retried. (I never used it.)

  • Versioning: Use git :-)

(Disclaimer: I've contributed a lot to Nikola, and I think I still have commit rights.)

Edit: some more points added to the initial post:

  • Custom landing page (ability to create landing page that is not "documentation layout"): as long as your blog root isn't /, you can put an arbitrary page there.
  • Button to edit pages directly: Should be possible to add to the theme for pages that are generated from content (like blog posts and regular pages)
  • Media support (embedding YouTube videos): Use the .. youtube:: RST directive (https://getnikola.com/handbook.html#youtube) or the media shortcode (https://getnikola.com/handbook.html#built-in-shortcodes)

@maxamillion
Copy link

+1 @felixfontein - I ironically had suggested Pelican purely because it seems to have the largest community around it, but I personally use Nikola for my site (that admittedly doesn't change often) and I've been a very happy user for many years.

@oraNod
Copy link
Author

oraNod commented Mar 21, 2023

Removing Hyde from the list of potential SSGs after discussion with @leogallego who proposed it. Hyde is not actively maintained so we shouldn't really consider it a viable option.

@oraNod
Copy link
Author

oraNod commented Mar 21, 2023

@maxamillion I've been looking at the Pelican option and have come up with this assessment against that checklist. I think you suggested Pelican so wanted to get your thoughts.

Pelican

Pelican is a great tool but maybe not as widely used as other options and doesn't really have a great selection of themes.

Requirements:

  • Ease of deployment - Pelican is quite fast and has caching and selective output writing capabilities. Build process is simple.
  • Custom landing page - Entirely possible to create a landing page from Jinja2.
  • Base templates and themes for rapid prototyping - Pelican doesn't have a great default theme and uses more of a blog layout. There is a pelican-themes repo with some options but most of them are quite old.
  • Easily add custom css when required but low requirement for theme customization, built-in cross-browser compatibility and responsive design - Pelican has high requirement for theme customization.
  • Write content in md or rst - Yes, Pelican uses the Python Markdown processor https://python-markdown.github.io/reference/#markdown
  • Button to edit pages directly
  • Blog capabilities - Yes, Pelican is actually a great choice for a standalone blog.
  • Basic search functionality - Yes, can depend on the theme but there is also a Stork search plugin: https://github.com/pelican-plugins/search
  • Well maintained project with recent commits - There are recent commits but mostly related to documentation: https://github.com/getpelican/pelican/commits/master - Last release of Pelican was in July 2022. Releases tend to be approximately twice a year.
  • i18n (content renders correctly for everyone) - Yes but this depends on the theme.
  • Media support (embedding YouTube videos) - Yes, according to Pelican docs: https://docs.getpelican.com/en/latest/tips.html#how-to-add-youtube-or-vimeo-videos

Nice to have:

  • Python extensibility / integration - Pelican is fully extensible.
  • Ability to extend templates and themes with Jinja

@oraNod
Copy link
Author

oraNod commented Mar 21, 2023

@felixfontein I've removed analytics and discourse integration from the list of nice to haves. Those probably are things that should come later.

@oraNod
Copy link
Author

oraNod commented Mar 21, 2023

@gotmax23 Here is an assessment on Hugo. Would you mind taking a look and seeing if there are any points you disagree with?

Hugo

Hugo is kind of the Ferrari of static site generators. It lets you build modern, SEO-friendly, and secure websites quickly and offers a lot of great features (like mermaidJS support). Hugo can build really great websites, like Manjaro Linux https://manjaro.org/ and LetsEncrypt https://letsencrypt.org/

On the other hand Hugo is written in Go and relies heavily on JavaScript. For the Ansible community site Hugo feels a bit like "outsider" technology that might present a barrier for engagement. Because the underlying tech stack is not the typical first choice for the Ansible community, Hugo would actually be a more complex option even though it offers a lot of flexibility and powerful tooling. That complexity could make it harder to change to a different static site generator after the community website starts to mature or for longer-term maintainability.

Requirements:

Nice to have:

  • Python extensibility / integration
  • Ability to extend templates and themes with Jinja - Hugo only uses Go templates.

@oraNod oraNod self-assigned this Mar 21, 2023
@oraNod
Copy link
Author

oraNod commented Mar 21, 2023

Sphinx

Sphinx is widely known for building documentation from RST source. It is not traditionally thought of as a static site generator although it can be used to create websites. One of the benefits of Sphinx as an SSG is being able to use intersphinx for linking across sites but this actually slows build time and can be resource intensive.

This most compelling point for Sphinx is that it is a very familiar tool for the Ansible community. At the same time there is some overhead to adapt Sphinx as a static site generator and it is probably a better choice to use MD with MyST than RST. There is a solid tutorial on that here: https://www.jetbrains.com/pycharm/guide/tutorials/sphinx_sites/

Requirements:

  • Ease of deployment (fast to build html, can put into gh action, low risk of breakage when upgrading)
  • Custom landing page (ability to create landing page that is not "documentation layout") - Sphinx lets you remove the traditional documentation style TOC nav with the html_sidebars configuration as well as with html_theme_options
  • Base templates and themes for rapid prototyping https://sphinx-themes.org/ Of course there is the Ansible Sphinx theme too but it requires some updates: Tracking an "ng" theme sphinx_ansible_theme#41
  • Easily add custom css when required but low requirement for theme customization, built-in cross-browser compatibility and responsive design - Sphinx has a pretty high requirement for theme customization.
  • Write content in md or rst
  • Button to edit pages directly - Yes but depends on the theme.
  • Blog capabilities - Extensions for blogging such as https://ablog.readthedocs.io/en/stable/
  • Basic search functionality - Yes but depends on the theme.
  • Well maintained project with recent commits https://github.com/sphinx-doc/sphinx
  • i18n (content renders correctly for everyone) - For documentation, yes. Sphinx has great translation. For websites this probably depends on the theme.
  • Media support (embedding YouTube videos) https://github.com/sphinx-contrib/youtube

Nice to have:

  • Python extensibility / integration
  • Ability to extend templates and themes with Jinja

@oraNod
Copy link
Author

oraNod commented Mar 22, 2023

MkDocs

MkDocs seems like a mixed bag. MkDocs itself is simple and straightforward, although it does not seem to be under as much active dev as other options.

The real option under consideration here is the material theme for MkDocs. Even the Ansible community theme for MkDocs is based on the material theme. In this regard MkDocs feels like a constrained choice that might limit the ability to adapt and build different layouts. This is especially true considering the fact that, like Sphinx, MkDocs is intended more for documentation projects than full websites.

Requirements:

Easy to add custom styling: https://www.mkdocs.org/user-guide/customizing-your-theme/#using-the-docs_dir - For the material theme: https://squidfunk.github.io/mkdocs-material/customization/#additional-stylesheets

The Ansible community theme is built on the material theme and provides a good starting point but has a high overhead for customization, especially considering more complex formats and templates beyond a documentation project.

  • Write content in md or rst - Supports MD only
  • Button to edit pages directly
  • Blog capabilities
  • Basic search functionality
  • Well maintained project with recent commits

https://github.com/mkdocs/mkdocs - It looks like there are no commits since November. However the material theme has more active contributors than MkDocs itself: https://github.com/squidfunk/mkdocs-material

The Ansible community theme has one contributor at the moment (yay, Sorin!): https://github.com/ansible/mkdocs-ansible

Nice to have:

  • Python extensibility / integration - MkDocs uses a Python stack
  • Ability to extend templates and themes with Jinja - MkDocs uses Jinja as the template engine

@oraNod
Copy link
Author

oraNod commented Mar 22, 2023

Lektor

Lektor offers the ability to model content and explicitly define the structure of the website. In this way it is convenient for separating content from layout.

Lektor makes it easy to get a site up and running quickly but the general lack of themes and basic default styles necessitates more UX work than other static site generators.

Requirements:

Nice to have:

  • Python extensibility / integration - Written in Python and provides an API
  • Ability to extend templates and themes with Jinja

@cybette
Copy link
Member

cybette commented Mar 22, 2023

I don't have a strong preference on any of the above, partly because I don't have experience with them. I have used Middleman, Jekyll, and Hyde (in addition to Wordpress and Hubspot which are not SSGs) and dislike all of them 😅

I might try out a couple of them over the weekend to get a feel, but I trust all you experts here to select one that's most suitable for the community's needs.

@webknjaz
Copy link
Member

My personal preference is Lektor because I worked with it and it's heavily customizable. It was initially written by the creator of Jinja and Flask. It's a bit like a CMS really that generates content that can be served statically.

@oraNod

I'm not sure what you mean by these but IMO for this type of task, we don't really need to rely on third-party themes and would need to make our own.

  • Easily add custom css when required but low requirement for theme customization, built-in cross-browser compatibility and responsive design

There's plugins integrating stuff like webpack and scss — I imagine they take care of this. Although, I'd go for a CSS framework like Tailwind that effectively makes this requirement irrelevant.

  • Button to edit pages directly

Not sure what you mean by this. In local dev mode, there's an edit button that takes you to the admin view. I think it works regardless of the theme...

Looks like there's also a plugin for static search at https://github.com/rlaverde/lektor-static-search.

@oraNod
Copy link
Author

oraNod commented Mar 22, 2023

@webknjaz Thanks! I agree Lektor is a great choice and I really like several aspects of it, especially the models. However I've started to wonder if it's the right tool for getting the Ansible community site off the ground. If it turns out that is not the case I think we should keep evaluating Lektor with a view to switching over if that serves any particular longer-term needs better.

I'm not sure what you mean by these but IMO for this type of task, we don't really need to rely on third-party themes and would need to make our own.

I agree to an extent but the community team has taken some lessons about ux from the prototype docsite. It's important that the initial effort have good ux from the very start. Until we get a bit more help with ux there is a need to be cautious and avoid too many design flaws.

@samccann
Copy link

@felixfontein - the bit about 'mindshare with the broader Ansible community' to me means - pick an SSG that multiple people in community would feel comfortable with and willing to assist in creating and maintaining the new website. This from the start is meant to be a community website for and by the Ansible community.

@samccann
Copy link

Coming at this as a novice and reading the discussion, seems Nikola and Lecktor both have that critical mindshare with community members and the important features we're looking for.

@samccann
Copy link

I ran an accessibility check on the lecktor and Nikola websites, just for fun. They both have similar number of identified issues and score overall... and both a better scores than Ansible.com today so.. taking that as win :-)

--and yep, realize our own website will have to take steps to be accessible, but thought it was an interesting datapoint anyway.

@gotmax23
Copy link
Contributor

A vote was started in #216 about whether to move forward with Nikola as the static site generator for the first iteration.

@gotmax23 gotmax23 changed the title Static site generator for the Ansible community web presence [Vote ends on 2023-03-30] Static site generator for the Ansible community web presence Mar 22, 2023
@gotmax23 gotmax23 added the active-vote These are currently active votes label Mar 22, 2023
@GregSutcliffe
Copy link
Contributor

Coming in late to this one, but I have no bombshells to drop :)

A couple of general comments first

  • @oraNod I wouldn't worry about "Discourse integration" or "analytics" too much. In both cases it's highly likely to be a JavaScript chunk that gets added to the appropriate part of the layout files, and I don't see any entry on this list that couldn't handle that. Here's the block that handles comments on TheForeman's blog
  • @mscherer completely agree with focusing on one thing at a time - building the new thing has the priority, we can link to existing stuff for now and look at that later
  • @samccann thanks for that - I'm with Mike Hoye (of Mozilla) on accessibility, we do it for a small group and it ends up benefiting many many more people (see the latter half of this blog for examples). Let's make that a priority

As to the actual choice, reading through the comments, it seems like any of these could do the job, and we're down to personal preference. On that basis I could vote for Hugo (since I use that for my site) but I don't want to cause bikeshedding, so I'll jump on the Nikola train so that we can get started actually building this thing. It gets plus-points because (as an ex-physicist myself) Tesla is a personal hero anyway :)

@felixfontein felixfontein changed the title [Vote ends on 2023-03-30] Static site generator for the Ansible community web presence [associated vote ends on 2023-03-30] Static site generator for the Ansible community web presence Mar 29, 2023
@felixfontein felixfontein added active-vote-discussion These are proposals that are currently voted on and removed active-vote These are currently active votes labels Mar 29, 2023
@felixfontein felixfontein changed the title [associated vote ends on 2023-03-30] Static site generator for the Ansible community web presence [associated vote ended on 2023-03-30] Static site generator for the Ansible community web presence Apr 3, 2023
@felixfontein felixfontein added being_implemented This is currently being implemented and removed active-vote-discussion These are proposals that are currently voted on labels Apr 3, 2023
@samccann
Copy link

samccann commented Apr 7, 2023

Thanks everyone! Closing this now as the nikola scaffolding is in place with ansible-community/community-website#28

@samccann samccann closed this as completed Apr 7, 2023
@samccann samccann added implemented and removed being_implemented This is currently being implemented labels Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests