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

Display Featured Stories #1479

Merged
merged 3 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}
Loading