Skip to content

Commit

Permalink
blog.jquery.com: Sync sites.php entry and import blog.jquery.com theme
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Krinkle committed Apr 8, 2024
1 parent f004bf9 commit 9131422
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 198 deletions.
10 changes: 0 additions & 10 deletions plugins/jquery-actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@
* Description: Default actions for all jQuery sites.
*/

remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

// Remove shortlink <head> and header.
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );

// Ensure relative links remain on the current protocol
// (such as references to theme assets and intra-site links).
// This does not influence 'home' and 'siteurl' options, and thus
Expand Down
17 changes: 15 additions & 2 deletions plugins/jquery-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,21 @@
}
unset( $sites, $options, $option );

// Disable WordPress auto-paragraphing for posts.
remove_filter( 'the_content', 'wpautop' );
// Remove misc links from <head> on non-blog sites
if ( !get_option( 'jquery_is_blog' ) ) {
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0 );

// Remove shortlink <head> and header.
remove_action( 'wp_head', 'wp_shortlink_wp_head', 10 );
remove_action( 'template_redirect', 'wp_shortlink_header', 11 );

// Disable WordPress auto-paragraphing for posts, except on actual blog sites
remove_filter( 'the_content', 'wpautop' );
}

// Disable WordPress text transformations (smart quotes, etc.) for posts.
remove_filter( 'the_content', 'wptexturize' );
Expand Down
13 changes: 9 additions & 4 deletions sites.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ function jquery_sites() {
'blog_id' => 2,
'cookie_domain' => '.jquery.com',
'options' => array(
'blogname' => 'jQuery Blog',
'stylesheet' => 'blog-jquery-com',
// 'permalink_structure' => '/%category%/%postname%/',
'blogname' => 'Official jQuery Blog',
'blogdescription' => 'New Wave JavaScript',
'jquery_author' => 'jQuery Team - jquery.com',
'jquery_description' => 'jQuery: The Write Less, Do More, JavaScript Library',
'stylesheet' => 'blog.jquery.com',
'jquery_body_class' => 'jquery',
'permalink_structure' => '/%year%/%monthnum%/%day%/%postname%/',
'jquery_is_blog' => true,
),
),
'api.jquery.com' => array(
Expand Down Expand Up @@ -395,10 +399,11 @@ function jquery_default_site_options() {
'blogdescription' => '',
'permalink_structure' => '/%postname%/',
'use_smilies' => 0,

// The one site where comments are sometimes enabled (blog.jquery.com)
// has always had thread_comments turned off.
//
// Oher sites like api.jquery.com implement their pages as posts,
// Other sites like api.jquery.com implement their pages as posts,
// but naturally don't support comments at all. Turn this off to
// remove the WordPress comment-reply script from pages by default.
'thread_comments' => 0,
Expand Down
31 changes: 31 additions & 0 deletions themes/blog.jquery.com/sidebar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<div id="sidebar" class="widget-area" role="complementary">
<aside class="widget">
<h3 class="widget-title">Categories</h3>
<ul>
<?php wp_list_categories(array(
'depth' => 1,
'title_li' => '',
'exclude' => '1'
)); ?>
</ul>
</aside>
<aside class="widget">
<h3 class="widget-title">Recent Posts</h3>
<ul>
<?php
$recent_posts = wp_get_recent_posts(array(
'post_status' => 'publish'
));
foreach( $recent_posts as $recent ){
echo '<li><a href="' . get_permalink($recent["ID"]) . '">' . $recent["post_title"].'</a></li>';
}
?>
</ul>
</aside>
<aside class="widget">
<h3 class="widget-title">Archives</h3>
<ul>
<?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>
</ul>
</aside>
</div>
2 changes: 2 additions & 0 deletions themes/blog.jquery.com/single.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?php
get_template_part( 'single', 'blogpost' );
165 changes: 165 additions & 0 deletions themes/blog.jquery.com/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,168 @@
Theme Name: blog-jquery-com
Template: jquery
*/

a,
.title {
color: #b24926;
}
#content a:hover {
color: #333;
}

.assistive-text,
.screen-reader-text {
position: absolute !important;
clip: rect(1px, 1px, 1px, 1px);
overflow: hidden;
height: 1px;
width: 1px;
}

/* Copied from blog.jquery.com-theme.git:/jquery/css/blog.css */

.alignright {
float: right;
}
.alignleft {
float: left;
}

.entry-posted {
color: #999;
font-size: 12px;
}

/* =Comments
----------------------------------------------- */

#comments-title,
#content h2#comments-title {
margin-top: 2.6em;
text-transform: uppercase;
}
.nopassword,
.nocomments {
font-size: 24px;
font-weight: 100;
margin: 26px 0;
}
.commentlist {
list-style: none;
margin: 0 auto;
}
.content .commentlist {
width: 100%; /* reset the width for the one-column layout */
}
#comments .commentlist > li.comment {
background: #f6f6f6;
border: 1px solid #ddd;
border-radius: 3px;
margin: 0 0 1em 60px;
padding: 5px 12px 0;
position: relative;
word-wrap: break-word;
}
#comments .commentlist > li.pingback {
margin: 0 0 1em 60px;
padding: 0 1.625em;
}
.comment-meta .fn {
font-style: normal;
font-weight: bold;
}
.comment-meta {
color: #666;
font-size: 12px;
line-height: 2.2em;
}
/* Post author highlighting */
#comments .commentlist > li.bypostauthor {
border-color: #0769ad; /* jQuery Primary Blue */
}
#comments .commentlist > li.bypostauthor .comment-meta {
background: #ddd;
border-radius: 3px 3px 0 0;
color: inherit;
margin: -5px -12px 5px -12px;
padding: 5px 12px;
}
.commentlist .avatar {
border-radius: 3px;
box-shadow: 0 1px 2px #ccc;
left: -82px;
padding: 0;
position: absolute;
top: 0;
}
a.comment-reply-link {
background: #eee;
border-radius: 3px;
color: #666;
display: inline-block;
font-size: 12px;
padding: 0 8px;
text-decoration: none;
}
a.comment-reply-link:hover,
a.comment-reply-link:focus,
a.comment-reply-link:active {
background: #888;
color: #fff;
}
a.comment-reply-link > span {
display: inline-block;
position: relative;
top: -1px;
}

/* Comment Form */
#respond {
background: #f6f6f6;
border: 1px solid #ddd;
border-radius: 3px;
margin: 0 0 1.625em;
padding: 1.625em;
}
#respond form {
padding: 0;
}
#respond p {
margin: 10px 0;
}
#respond .comment-notes,
#respond .logged-in-as,
#respond label {
font-size: 12px;
}
#respond label {
line-height: 2.2em;
}
#respond .comment-form-comment label {
display: block;
}
#respond .required {
color: #bd3500;
font-weight: bold;
}
#respond input[type="text"],
#respond textarea {
background: #fff;
border-radius: 5px;
padding: 10px;
}
#respond textarea {
resize: vertical;
width: 95%;
}
#respond input[type=text] {
display: block;
height: 24px;
width: 75%;
}
#respond .form-submit {
text-align: right;
}
#respond input[type=submit] {
float: none;
}
2 changes: 1 addition & 1 deletion themes/jquery/archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<?php _e( 'Blog Archives', 'twentyeleven' ); ?>
<?php endif; ?>
</h1>
<hr class="dots">
<hr>
</header>

<?php
Expand Down
1 change: 1 addition & 0 deletions themes/jquery/author.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<h1 class="page-title author"><?php
printf( __( 'Author Archives: %s', 'twentyeleven' ), get_the_author() );
?></h1>
<hr>
</header>

<?php
Expand Down
24 changes: 16 additions & 8 deletions themes/jquery/comments.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
<div id="comments">
<?php if ( post_password_required() ) : ?>
<p class="nopassword"><?php _e( 'This post is password protected. Enter the password to view any comments.', 'twentyeleven' ); ?></p>
</div><!-- #comments -->
<?php
// Skip the rest of comments.php.
return;
endif;
?>
<?php if ( have_comments() ) : ?>
<h2 id="comments-title">
<?php
Expand All @@ -8,10 +16,11 @@
</h2>

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav id="comment-nav-above">
<nav class="pagination">
<h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
<?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?>
<?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?>
<hr>
</nav>
<?php endif; ?>

Expand All @@ -20,10 +29,9 @@
</ol>

<?php if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) : ?>
<nav id="comment-nav-below">
<h1 class="assistive-text"><?php _e( 'Comment navigation', 'twentyeleven' ); ?></h1>
<div class="nav-previous"><?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?></div>
<div class="nav-next"><?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?></div>
<nav class="pagination">
<?php previous_comments_link( __( '&larr; Older Comments', 'twentyeleven' ) ); ?>
<?php next_comments_link( __( 'Newer Comments &rarr;', 'twentyeleven' ) ); ?>
</nav>
<?php endif; // check for comment navigation ?>

Expand All @@ -37,4 +45,4 @@
<?php endif; ?>

<?php comment_form(); ?>
</div>
</div>
7 changes: 5 additions & 2 deletions themes/jquery/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@
<?php endif; ?>

<?php if ( 'post' == get_post_type() ) : ?>
<div class="entry-meta">
<div class="entry-posted">
<?php jq_posted_on(); ?>
</div>
<?php endif; ?>
</header>

<?php if ( is_search() ) : // Only display Excerpts for Search ?>
<?php
// Show excerpt in search, archives (year, author, category), and non-latest items on blog homepage
if ( ( is_home() && get_next_post_link() ) || is_archive() || is_search() ) :
?>
<div class="entry-summary">
<?php the_excerpt(); ?>
</div>
Expand Down

0 comments on commit 9131422

Please sign in to comment.