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

  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
  • Loading branch information
Krinkle committed Apr 7, 2024
1 parent f004bf9 commit 01d05dd
Show file tree
Hide file tree
Showing 17 changed files with 413 additions and 92 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
11 changes: 8 additions & 3 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,6 +399,7 @@ 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.
//
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' );
289 changes: 289 additions & 0 deletions themes/blog.jquery.com/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,292 @@
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,
.page-template-sidebar-page-php .commentlist {
width: 100%; /* reset the width for the one-column and sidebar page layout */
}
#comments .commentlist > li.comment {
background: #f6f6f6;
border: 1px solid #ddd;
border-radius: 3px;
margin: 0 0 1em 53px;
padding: 1em 1.2em 0.2em 1.2em;
position: relative;
word-wrap: break-word;
}
#comments .commentlist > li.pingback {
margin: 0 0 1em 53px;
padding: 0 1.625em;
}
.commentlist .children {
list-style: none;
margin: 0;
}
.commentlist .children li.comment {
background: #fff;
border-left: 1px solid #ddd;
border-radius: 0 3px 3px 0;
margin: 1.625em 0 0;
padding: 1.625em;
position: relative;
}
.commentlist .children li.comment .fn {
display: block;
}
.comment-meta .fn {
font-style: normal;
font-weight: bold;
}
.comment-meta {
color: #666;
font-size: 12px;
line-height: 2.2em;
}
.commentlist .children li.comment .comment-meta {
line-height: 1.625em;
margin-left: 50px;
}
.commentlist .children li.comment .comment-content {
margin: 1.625em 0 0;
word-break: break-all;
word-break: break-word;
-webkit-hyphens: auto;
hyphens: auto;
}
.commentlist .avatar {
border-radius: 3px;
box-shadow: 0 1px 2px #ccc;
left: -82px;
padding: 0;
position: absolute;
top: 0;
}
.commentlist .children .avatar {
background: none;
box-shadow: none;
left: 2.2em;
padding: 0;
top: 2.2em;
}
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;
}

/* Post author highlighting */
.commentlist > li.bypostauthor {
background: #ddd;
border-color: #d3d3d3;
}
.commentlist > li.bypostauthor .comment-meta {
color: #575757;
}

/* Post Author threaded comments */
.commentlist .children > li.bypostauthor {
background: #ddd;
border-color: #d3d3d3;
}

/* sidebar-page.php comments */
/* Make sure we have room for our comment avatars */
.page-template-sidebar-page-php .commentlist > li.comment,
.page-template-sidebar-page-php.commentlist .pingback {
margin-left: 102px;
width: auto;
}
/* And a full-width comment form */
.page-template-sidebar-page-php #respond {
width: auto;
}

/* Comment Form */
#respond {
background: #ddd;
border: 1px solid #d3d3d3;
border-radius: 3px;
margin: 0 auto 1.625em;
padding: 1.625em;
position: relative;
}
#respond input[type="text"],
#respond textarea {
background: #fff;
border: 4px solid #eee;
border-radius: 5px;
box-shadow: inset 0 1px 3px rgba(204,204,204,0.95);
position: relative;
padding: 10px;
}
#respond .comment-form-author,
#respond .comment-form-email,
#respond .comment-form-url,
#respond .comment-form-comment {
position: relative;
}
#respond .comment-form-comment label {
display: block;
}
#respond textarea {
resize: vertical;
width: 95%;
}
#respond .comment-form-author .required,
#respond .comment-form-email .required {
color: #bd3500;
font-size: 22px;
font-weight: bold;
left: -13px;
top: 6px;
position: absolute;
z-index: 1;
}
#respond .comment-notes,
#respond .logged-in-as {
font-size: 13px;
}
#respond p {
margin: 10px 0;
}
#respond .form-submit {
float: right;
margin: -20px 0 10px;
}
#respond input#submit {
background: #222;
border: none;
border-radius: 3px;
box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
color: #eee;
cursor: pointer;
font-size: 15px;
margin: 20px 0;
padding: 5px 42px 5px 22px;
position: relative;
left: 20px;
text-shadow: 0 -1px 0 rgba(0,0,0,0.3);
}
#respond input#submit:active {
background: #1982d1;
color: #bfddf3;
}
#respond #cancel-comment-reply-link {
color: #666;
margin-left: 10px;
text-decoration: none;
}
#respond .logged-in-as a:hover,
#respond #cancel-comment-reply-link:hover {
text-decoration: underline;
}
.commentlist #respond {
margin: 1.625em 0 0;
width: auto;
}
#reply-title {
color: #373737;
font-size: 24px;
font-weight: bold;
line-height: 30px;
}
#cancel-comment-reply-link {
color: #888;
display: block;
font-size: 10px;
font-weight: normal;
line-height: 2.2em;
letter-spacing: 0.05em;
position: absolute;
right: 1.625em;
text-decoration: none;
text-transform: uppercase;
top: 1.1em;
}
#cancel-comment-reply-link:focus,
#cancel-comment-reply-link:active,
#cancel-comment-reply-link:hover {
color: #ff4b33;
}
#respond label {
line-height: 2.2em;
}
#respond input[type=text] {
display: block;
height: 24px;
width: 75%;
}
#respond p {
font-size: 12px;
}
p.comment-form-comment {
margin: 0;
}
.form-allowed-tags {
display: none;
}
Loading

0 comments on commit 01d05dd

Please sign in to comment.