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

Switch wpblogs server to use jquery-wp-content instead of fork at blog.jquery.com-theme #17

Open
2 of 8 tasks
Krinkle opened this issue Jul 6, 2023 · 3 comments
Open
2 of 8 tasks
Assignees
Labels
Service: Backups mainly Tarsnap. Type: Enhancement New feature or request

Comments

@Krinkle
Copy link
Member

Krinkle commented Jul 6, 2023

blog.jquery.com-theme is effectively a fork of jquery-wp-content.

Proposed:

  • Update the fork with the latest "jquery" theme from jquery-wp-content.
  • Update jquery-wp-content with the latest blog theme, including missing theme for jqueryui and jquerymobile.
  • Write wpblogs puppet code to support jquery-wp-content next to current provision.
  • Switch one wpblogs install (jquerymobile blog?) to use jquery-wp-content.
  • Switch other wpblogs installs to use jquery-wp-content.
  • Add wpblogs to GitHub org settings as hook recipient.
  • Simplify wpblogs puppet code to remove unneeded abstraction and improve reuse.
  • Archive repo at https://github.com/jquery/blog.jquery.com-theme.

@supertassu Are you aware of aspects of jquery-wp-content (specifically, the "next" branch) that would make it difficult to use for the blogs? E.g. things that perhaps the blog fork has stripped out that might pose issues?

The main thing I can think of is the multi-site aspects, but we've weeded those out on for the new wpdocs servers where we don't use multi-site WordPress, so I suspect it'd be fine, but curious what you think.

@Krinkle Krinkle self-assigned this Jul 7, 2023
@Krinkle Krinkle transferred this issue from another repository Aug 30, 2023
@Krinkle Krinkle transferred this issue from jquery/infrastructure-issues Aug 30, 2023
@Krinkle Krinkle added Type: Enhancement New feature or request Service: Backups mainly Tarsnap. labels Aug 30, 2023
Krinkle added a commit to jquery/jquery-wp-content that referenced this issue Sep 18, 2023
We never enabled it on the new infra for doc sites, and it was also
never enabled on the blogs.

The default search seems good enough on WordPress 6, plus for the
most important sites (jquery.com, jqueryui.com) we use
Typesense/Algolia

Ref jquery/infrastructure-puppet#17.
Ref jquery/infrastructure-puppet#33.
Krinkle added a commit to jquery/jquery-wp-content that referenced this issue Apr 4, 2024
Over the years, the addition and subsequent removal of the aside/broadcast
banner to the non-blog theme, has created an unintended drift in where
the logo is aligned in the site header.

The logo was flushed to the left edge of the screen with seemingly
large margin gap above it. Fix this to align with how it renders
on the blog.

Ref jquery/infrastructure-puppet#17
Krinkle added a commit to jquery/jquery-wp-content that referenced this issue Apr 7, 2024
The version of this theme in this repo is practicaly empty and hasn't
been used in a long time. When activating this locally via jquery-wp-docker,
I noticed the settings don't match what we use in production.

* Import files from:
  https://github.com/jquery/blog.jquery.com-theme/tree/6710984735eb/jquery.com

  Refactor files slightly to work on the current version of the base
  theme.

  blog.jquery.com-theme/jquery/
  - /header.php
    /footer-bottom.php
    /menu-header.php
    /page-fullwidth.php
    /searchform.php

    Minor differences, differed only in being a older but compatible
    version. Kept the newer ones here unchanged.
    (e.g. still mentioned Forum, IRC, and StackPath, and older search
    input field styling).

  - /functions.jquery.php
    This defined one extra function, jq_logo_link, which served
    as a workaround for missing some parts of jquery-wp-content
    by hardcoding `return '/'`, and already had a TODO for removing
    it when merging into jquery-wp-content. It was used in header.php,
    where we now use `get_option('jquery_logo_link', '/')` which
    works fine for the blog.

  blog.jquery.com-theme/jquery.com/
  - /functions.php:
    The body_class filter for class "listing" is already here
    as part of plugins/jquery-filters.php.

    The twentyeleven_comment (now jq_comment) function had logic
    for pingbanks. Import this code over so that (approved) pingbacks
    remain displayed among blog comments.

  - /category.php
    Identical to the one in the current "jquery" base theme,
    except for the heading "Category Archives" instead of "Category".
    This is presumably because API pages are considered posts in a
    category, and so the word "Archives" would be confusing there.
    Solve this by keeping the neutral "Category" that we have in
    the base theme and remove the forked veersion for that one word
    difference.

  - /content.php
    The only difference was the class "entry-posted" instead of
    "entry-meta" for the "posted on" date. This branch in the base
    theme is never used, so change it to the one the blog has.

    The entry-posted class is styled nearly the same as entry-meta
    except that in category/search listings we don't float "post on"
    to the right, whereas entry-meta categories are.

  - /single.php
    This is an override for blog posts. In order to share this neatly
    across the three blogs in the future, I've added this to the
    base theme as "single-blogpost.php" with a stub in
    blog.jquery.com/single.php that references this. This is akin to
    how we share templates for API sites with single-api.php.

* comments.php: Add missing support for post_password_required
  This is included at https://github.com/jquery/blog.jquery.com-theme
  but missing here. Given no other sites use this, prefer to keep this
  as-is instead of figuring out whether it is safe to remove.

* base.css: Move text-shadow from `blockquote p` to `blockquote`.
  In markdown, things generally get wrapped in paragraphs, but in
  WordPress they typically don't. Tweak this to match the styles of
  the blog theme instead, which should still apply to paragraphs
  inside quotes just as well.
  Follows-up #454.

Ref jquery/infrastructure-puppet#17
Krinkle added a commit to jquery/jquery-wp-content that referenced this issue Apr 10, 2024
The version of this theme in this repo is practicaly empty and hasn't
been used in a long time. When activating this locally via jquery-wp-docker,
I noticed the settings don't match what we use in production.

Import files from:
https://github.com/jquery/blog.jquery.com-theme/tree/6710984735eb/jquery.com

And refactor these slightly in order to work with the current version
of the base theme.

blog.jquery.com-theme/jquery/
* /header.php
  /footer-bottom.php
  /menu-header.php
  /page-fullwidth.php
  /searchform.php

  Minor differences, differed only in being a older but compatible
  version. Kept the newer ones here unchanged.
  (e.g. still mentioned Forum, IRC, and StackPath, and older search
  input field styling).

* /functions.jquery.php
  This defined one extra function, jq_logo_link, which served
  as a workaround for missing some parts of jquery-wp-content
  by hardcoding `return '/'`, and already had a TODO for removing
  it when merging into jquery-wp-content. It was used in header.php,
  where we now use `get_option('jquery_logo_link', '/')` which
  works fine for the blog.

* /comments.php
  Support for post_password_required is present at
  https://github.com/jquery/blog.jquery.com-theme but missing here.
  Given non-blog sites wouldn't use this it makes sense that it was
  absent. Cary this over as-is instead of figuring out whether we
  want or need it. It won't do anything on regular blog posts
  or an any non-blog sites.

blog.jquery.com-theme/jquery.com/
* /functions.php:
  The body_class filter for class "listing" is already here
  as part of plugins/jquery-filters.php.

  The twentyeleven_comment (now jq_comment) function had logic
  for pingbanks. Import this code over so that (approved) pingbacks
  remain displayed among blog comments.

* /category.php
  Identical to the one in the current "jquery" base theme,
  except for the heading "Category Archives" instead of "Category".
  This is presumably because API pages are considered posts in a
  category, and so the word "Archives" would be confusing there.
  Solve this by keeping the neutral "Category" that we have in
  the base theme and remove the forked veersion for that one word
  difference.

* /content.php
  The only difference was the class "entry-posted" instead of
  "entry-meta" for the "posted on" date. This branch in the base
  theme is never used, so change it to the one the blog has.

  The entry-posted class is styled nearly the same as entry-meta
  except that in category/search listings we don't float "post on"
  to the right, whereas entry-meta categories are.

* /single.php
  This is an override for blog posts. In order to share this neatly
  across the three blogs in the future, I've added this to the
  base theme as "single-blogpost.php" with a stub in
  blog.jquery.com/single.php that references this. This is akin to
  how we share templates for API sites with single-api.php.

Additional CSS changes and fixes relating to blog posts:

* Move text-shadow from `blockquote p` to `blockquote`.

  On our doc sites, HTML comes from Markdown parsers, which generally
  wrap text paragraphs. In WordPress, our blog posts are already
  stored in HTML, where there is generally not a paragraph wrapper
  within simple blockquotes. Fix our styles accomodate blog posts
  with blockquotes by applying this to the outer element. It should
  not affect any blockquotes that do for some reason have paragraphs
  in them, as they inherit the text-shadow just the same.
  Follows-up #454.

* Fix broken `#comments-title` rule,
  lost to `#content h2`.

  Fix broken `.commentlist > li.bypostauthor` rule,
  lost to `#comments .commentlist > li.comment`.

  These were already broken on the blog,
  Bring these back in a more suble way (the original, if restored,
  was quite dark and imho hard to read), and strengthen the selector
  for now as-needed (one day, we'll get rid of these ID selectors...)

* Remove unused `#reply-title` rule,
  lost in practice to `#content h3`, which seems fine as-is.

* Remove unused `p.comment-form-comment` rule,
  lost in practice to `#respond p`, which looks fine.

* Remove unused `.commentlist .children` rules.
  Unused for a long time since thread_comments=0 on all sites,
  including on the blogs. When thread_comment equals 0, it applies
  how old comment threads are rendered as well, so these truly are
  unused.

* Remove unused `#cancel-comment-reply-link`,
  this is specific to WordPress's comment-reply.js,
  which we don't load.

* Remove unused `.page-template-sidebar-page-php` rules.

  https://github.com/search?q=org%3Ajquery+pageTemplate+NOT+repo%3Ajquery%2Firc.jquery.org+NOT+repo%3Ajquery%2Fevents.jquery.org&type=code

  https://github.com/search?q=org%3Ajquery+%22sidebar-page.php%22+NOT+repo%3Ajquery%2Fblog.jquery.com-theme&type=code

Ref jquery/infrastructure-puppet#17
Krinkle added a commit to jquery/jquery-wp-docker that referenced this issue Apr 12, 2024
Krinkle added a commit to jquery/jquery-wp-content that referenced this issue Apr 17, 2024
The remaining differences are tiny and this way we avoid having
to rename the active theme, which makes both staging the deployment,
and the actual deployment, easier.

Settle some blog utilities in places that we can reuse across
all three of blog.jquery.com, blog.jqueryui.com,
and blog.jquerymobile.com:

* Move sidebar.php to theme/jquery/sidebar-blogpost.php.
  This is the same for all three sites and can be a boolean toggle
  instead.

* Move single.php to theme/jquery.com/
  This was already previously abstracted as single-blogpost.php
  in the base theme, so this is only a stub file to load that.

  Given that there are no blog posts on jquery.com itself,
  this is safe to put in the jquery.com theme and thus have the
  two be shared. If there were to be blog posts there at some point,
  this would naturally be the appropiate way to style them anyway.

  The only site that can't easily be shared is api.jquery.com, given
  that it structures its API pages as single "posts", thus needing
  at least something somewhere to make sure single.php renders like
  an API page instead of dated blog post.

Remove twentyeleven remnants:

* Remove sidebar-footer.php. There are no `get_sidebar( 'footer' )`
  calls in this repo. This was a leftover from the twentyeleven
  theme.
* Remove redundant copy of license.txt, already in the top of the repo.
* Remove readme.txt, specific to Twenty Eleven.

Ref jquery/infrastructure-puppet#17
Krinkle added a commit to jquery/jquery-wp-content that referenced this issue Apr 18, 2024
Follows-up 9131422, which did most
of the legwork already by importing theme code for blog.jquery.com,
which I did (mostly) in a way that is shared and blended into the
jquery base theme so that there is very little to import from the
jqueryui and jquerymobile blog themes, yet producing an identical
rendering for them.

From https://github.com/jquery/blog.jquery.com-theme/tree/6710984735eb980cc9845b17f98aa0db8eac09e6/jqueryui.com
and https://github.com/jquery/blog.jquery.com-theme/tree/6710984735eb980cc9845b17f98aa0db8eac09e6/jquerymobile.com

blog/jqueryui.com -> themes/jqueryui.com
blog/jquerymobile.com -> themes/jquerymobile.com

* /category.php
  /index.php
  /style.css

  Redundant with inherited themes/jquery/category.php.
  Is identical apart from minor coding style differences.

* /content.php

  Redundant with inherited themes/jquery/content.php.

  Slight differences regarding showing excerpts for non-first
  results on the home page, which has been intentionally
  changed in previous commits to jquery-wp-content, and blog still
  has the older version. Ignore in favour of what we have here.

* /footer.php

  Same as destination themes/jqueryui.com/footer.php.

* /single.php
  /sidebar.php

  These differ from the base theme in an important way, but are
  identical to the one for blog.jquery.com, which I previously
  imported into the base theme single-blogpost.php and
  sidebar-blogpost.php, so we only need stubs there, just like we
  did in themes/jquery.com/ before.

* /functions.php
  - Hardcodes "jquery-ui" or "jquery-mobile" for body_class.
    We set this via the jquery_body_class option in sites.php instead.
  - Various dynamic body class entries.
    This is already covered by /plugins/jquery-filters.php,
    which we enable on all sites and will be enabled on the blog too
    when we switch it to use jquery-wp-content.

Additionally, blog/jquerymobile.com/ had a builder.css and builder.js.
They were copied to the blog when the blog originally forked off
from jquery-wp-content, and were never used there. The copy in the
original repo here has since been removed in
bd3f0d61cdc98
as part of #272.

Ref jquery/infrastructure-puppet#17
Krinkle added a commit to jquery/jquery-wp-docker that referenced this issue Apr 18, 2024
Krinkle added a commit to jquery/jquery-wp-docker that referenced this issue Apr 18, 2024
Krinkle added a commit to jquery/jquery-wp-docker that referenced this issue Apr 18, 2024
Krinkle added a commit to jquery/jquery-wp-docker that referenced this issue Apr 19, 2024
@timmywil
Copy link
Member

timmywil commented Jun 6, 2024

@Krinkle Is this done?

@Krinkle
Copy link
Member Author

Krinkle commented Jun 6, 2024

Not yet, the above is all prep work to make local testing possible, and fixing various bugs I found in the process of testing.

We haven't actually switched anything yet.

Next steps I'm thinking about:

  • Update wpblogs in Puppet to provision one of the sites (e.g. blog.jquerymobile.com) using wp-content and deploy that.
  • If alll goes well, convert the others accordingly.
  • Archive blog-theme repo.

@Krinkle
Copy link
Member Author

Krinkle commented Dec 25, 2024

Once wpblogs uses the same puppet code for jquery-wp-content, it'll automatically start a webhook listener to ensure latest for the theme code.

Per jquery/blog.jquery.com-theme#8 (comment), we'll need to actually wpblogs to in the GitHub org settings as hook recipient, otherwise the listener would never be called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Service: Backups mainly Tarsnap. Type: Enhancement New feature or request
Development

No branches or pull requests

2 participants