Skip to content

Commit

Permalink
Adds tag template to News theme
Browse files Browse the repository at this point in the history
** Why are these changes being introduced:

* DSpace@MIT currently sends traffic to a page showing all news articles
  with a specific "dspacemit" tag - the only such example of a tag index
  on the site. Unfortunately, this tag index is not displaying correctly
  due to a bug in the parent theme's tag template.
* On the legacy site, this display functions, but is a poor fit for the
  need because the display isn't branded correctly (it is partially
  branded with the parent theme)

** Relevant ticket(s):

* https://mitlibraries.atlassian.net/browse/pw-55

** How does this address that need:

* This adds a tag template to the News theme. It repeats the structure
  of the legacy display, being a paginated list of complete articles,
  instead of the category index that shows an AJAX-paginated list of
  cards.
* There is a small change to content-single.php in the News theme, which
  we realized was previously unused. Now it is used by the tag template,
  but we need to change one class to control how the article metadata is
  displayed (the former class name results in an absolutely-positioned
  element on screen, which was useful in a card display but is a bug
  here).
* The news styles are updated to ensure that large images don't overflow
  their container, and to add some padding around each news article in
  the list.
* The parent styles are updated to ensure that pagination links are
  placed alongside each other.
* The news theme version is bumped to 0.3.0. This is a nice-to-have,
  not required by the style changes as the changed stylesheets are not
  compiled by SCSS.

** Document any side effects to this change:

* The page structure we're using for the tag index is a new visual
  approach, but the work to provide an AJAX-powerd paginated list of
  cards would have been higher, and isn't justified by how little use
  this template will likely see.
  • Loading branch information
matt-bernhardt committed Sep 1, 2023
1 parent 2d9fad2 commit 1a08b23
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 4 deletions.
2 changes: 1 addition & 1 deletion web/app/themes/mitlib-news/content-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
?>
</span>
<?php if ( has_category() ) : ?>
<span class="category-post">
<span class="category-post-single">

<?php
$category = get_the_category();
Expand Down
9 changes: 8 additions & 1 deletion web/app/themes/mitlib-news/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Theme Name: MITlib News
Author: MIT Libraries
Version: 0.2.0
Version: 0.3.0
Description: A child theme of the MIT Libraries' parent, focused on News features and content.
Template: mitlib-parent
Expand Down Expand Up @@ -832,6 +832,9 @@ h2.grid {
padding: 0px;
padding-left: 8px;
}
.mitContent {
overflow: auto;
}
.mitContent h2, .mitContent h3, .mitContent h4 {
margin: 0px;
padding: 0px;
Expand Down Expand Up @@ -872,6 +875,10 @@ article {
padding-left: 20px;
padding-right: 20px
}
.tag article {
padding-top: 10px;
margin-bottom: 20px;
}
.classCheck:nth-child(n+4) {
display: none;
}
Expand Down
34 changes: 34 additions & 0 deletions web/app/themes/mitlib-news/tag.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php
/**
* The template for displaying all content with a single tag.
*
* @package MITlib_News
* @since 0.3.0
*/

namespace Mitlib\News;

get_header();
?>

<?php get_template_part( 'inc/sub-header' ); ?>

<div id="content" role="main">
<?php if ( have_posts() ) : ?>
<div class="container container-fluid">
<div class="row">
<h1 class="lib-header">Tag: <strong><?php echo esc_html( single_tag_title( '', false ) ); ?></strong></h1>
<?php
while ( have_posts() ) :
the_post();
get_template_part( 'content', 'single' );
endwhile;
?>
<?php \Mitlib\Parent\content_nav( 'nav-below' ); ?>
</div>
</div>
<?php endif; ?>
</div><!-- #content -->

<div class="container">
<?php get_footer(); ?>
4 changes: 2 additions & 2 deletions web/app/themes/mitlib-parent/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ img.wp-smiley,
.nav-previous,
.previous-image {
float: left;
width: 50%;
width: 48%;
}
.meta-nav {
position: relative;
Expand All @@ -454,7 +454,7 @@ img.wp-smiley,
.next-image {
float: right;
text-align: right;
width: 50%;
width: 48%;
}
.nav-single + .comments-area,
#comment-nav-above {
Expand Down

0 comments on commit 1a08b23

Please sign in to comment.