Skip to content

Commit

Permalink
Display Featured Stories (#1479)
Browse files Browse the repository at this point in the history
* Display featured stories

* Do not show current testimonial in sidebar in Single Story page
  • Loading branch information
ibrahimjaved12 authored Jan 6, 2025
1 parent b848f5c commit 9e5c5dd
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 22 deletions.
3 changes: 2 additions & 1 deletion www/layouts/partials/home_stories.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- $stories := where .Site.RegularPages "Type" "==" "stories" -}}
{{- $featuredStories := .Site.Data.homepage.featured_stories.content | default slice -}}
{{- $stories := partial "filtered_pages" (dict "context" . "featuredPagesUid" $featuredStories) | default (where .Site.RegularPages "Type" "==" "stories") -}}
{{- $storiesSection := .Site.GetPage "section" "stories" -}}
{{- $breakdowns := dict
"xs-sm" (dict "size" 1 "class" "d-flex d-md-none")
Expand Down
11 changes: 6 additions & 5 deletions www/layouts/stories/list.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{{ define "main" }}
{{- $pages := .Site.RegularPages -}}
{{- $stories := where $pages "Type" "==" "stories" -}}
{{- $featuredStories := .Site.Data.homepage.featured_stories.content | default slice -}}
{{- $stories := partial "filtered_pages" (dict "context" . "featuredPagesUid" $featuredStories) | default (where $pages "Type" "==" "stories") -}}
<div class="testimonial-list-container">
{{ block "header" . }}
{{ partialCached "header" . }}
{{end}}
{{ end }}
<div class="testimonial-banner list d-flex flex-column">
<div class="standard-width container text-center">
<h1>OpenCourseWare Stories</h1>
<p>MIT students' stories reflect a relentless pursuit of knowledge and innovation. From coding breakthroughs to launching startups, their journey showcases the Institute's commitment to pushing boundaries and changing the world.</p>
<h1>OpenCourseWare Stories</h1>
<p>MIT students' stories reflect a relentless pursuit of knowledge and innovation. From coding breakthroughs to launching startups, their journey showcases the Institute's commitment to pushing boundaries and changing the world.</p>
</div>
</div>
<div class="standard-width container">
Expand Down Expand Up @@ -37,7 +38,7 @@ <h1>OpenCourseWare Stories</h1>
</div>
</div>
</div>
{{ partial "home_stories_banner.html" (dict "source" "list")}}
{{ partial "home_stories_banner.html" (dict "source" "list") }}
{{ block "footer" . }} {{ partialCached "footer" . }} {{ end }}
{{ partial "testimonial_quote_modal.html" }}
{{ end }}
39 changes: 23 additions & 16 deletions www/layouts/stories/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,31 @@ <h2>{{ $story.Title }}</h2>
<div class="more-stories">
<h3>More Stories</h3>
<div class="d-flex flex-wrap more-stories-item-cards-wrapper">
{{ range $index, $testimonial := first 4 (where .Site.RegularPages "Type" "==" "stories") }}
{{- $featuredStories := .Site.Data.homepage.featured_stories.content | default slice -}}
{{- $stories := partial "filtered_pages" (dict "context" . "featuredPagesUid" $featuredStories) | default (where .Site.RegularPages "Type" "==" "stories") -}}
{{- $limitedStories := first 5 $stories -}}
{{- $filteredStories := where $limitedStories "Permalink" "!=" $story.Permalink -}}

{{ range $index, $testimonial := first 4 $filteredStories }}
<div class="d-flex flex-nowrap justify-content-center col-12 col-md-6 col-lg-12 m-0 p-0">
<a
data-modal-content-id="modal-content-{{ $index }}"
class="item-wrapper d-block testimonial-link {{if $testimonial.Params.is_quote}}js-modal-trigger{{end}} text-decoration-none"
{{ if $testimonial.Params.is_quote }}
href="#"
data-toggle="modal"
{{ else }}
href="{{ $testimonial.RelPermalink }}"
<a
data-modal-content-id="modal-content-{{ $index }}"
class="item-wrapper d-block testimonial-link {{if $testimonial.Params.is_quote}}js-modal-trigger{{end}} text-decoration-none"
{{ if $testimonial.Params.is_quote }}
href="#"
data-toggle="modal"
{{ else }}
href="{{ $testimonial.RelPermalink }}"
{{ end }}
>
{{ partial "testimonial_card.html" (dict "testimonial" $testimonial "index" $index) }}
</a>
{{ if $testimonial.Params.is_quote }}
<div id="modal-content-{{ $index }}" class="hidden-modal-content">
{{ partial "testimonial_card.html" (dict "testimonial" $testimonial "context" "modal") }}
</div>
{{ end }}
>
{{ partial "testimonial_card.html" (dict "testimonial" $testimonial "index" $index) }}
</a>
<div id="modal-content-{{ $index }}" class="hidden-modal-content">
{{ partial "testimonial_card.html" (dict "testimonial" $testimonial "context" "modal") }}
</div>
</div>
{{ end }}
</div>
<div>
Expand All @@ -76,7 +83,7 @@ <h3>More Stories</h3>
</div>
</div>
</div>
{{ block "footer" . }} {{ partialCached "footer" . }} {{end}}
{{ block "footer" . }} {{ partialCached "footer" . }} {{ end }}
</div>
{{ partial "testimonial_quote_modal.html" }}
{{ end }}

0 comments on commit 9e5c5dd

Please sign in to comment.