Skip to content

Commit

Permalink
Merge pull request #140 from mpourismaiel/refactor/simplify-self-link
Browse files Browse the repository at this point in the history
Replace self_link with file name of each resource
  • Loading branch information
stp-ip authored May 28, 2018
2 parents 722a0d9 + a22244d commit 9acba01
Show file tree
Hide file tree
Showing 38 changed files with 34 additions and 49 deletions.
1 change: 0 additions & 1 deletion exampleSite/content/index/awesome-team.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "member"
date = "2017-10-17"
weight = 900
#background = "dark"
self_link = "member-fragment"

title = "Member Fragment"
subtitle = "Highly motivated Gophers"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/button_download.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "buttons"
date = "2016-09-07"
weight = 700
background = "secondary"
self_link = "buttons-fragment-secondary"

title = "Buttons Fragment"
subtitle = "Using secondary background"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/buttons.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "buttons"
date = "2016-09-07"
weight = 720
background = "primary"
self_link = "buttons-fragment"

title = "Buttons Fragment"
subtitle = "Using primary background"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/buttons_contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "buttons"
date = "2016-09-07"
weight = 710
#background = ""
self_link = "button-fragment"

title = "Buttons Fragment"
#subtitle = ""
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/contact.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "contact"
date = "2017-09-10"
weight = 1100
#background = "light"
self_link = "contact-fragment"
form_name = "defaultContact"

title = "Contact fragment"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/embed_subscribe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "embed"
date = "2017-10-07"
weight = 1050
background = "light"
self_link = "contact"
form_name = "subscribe"

#title = ""
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/embed_video.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "embed"
date = "2017-09-09"
weight = 800
background = "secondary"
self_link = "video-fragment"

title = "Embed Fragment"
subtitle = "Easily embed media (videos, iframes etc.)"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_button-center.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 420
background = "dark"
self_link = "item-fragment-button-center"
align = "center"

title = "Item Fragment Button Center"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_button-left.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 410
#background = ""
self_link = "item-fragment-button-left"
align = "left"

title = "Item Fragment Button Left"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_button-right.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 400
background = "dark"
self_link = "item-fragment-button-right"
align = "right"

title = "Item Fragment Button Right"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_icon-center.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 310
background = "secondary"
self_link = "item-fragment-icon-center"
align = "center"

title = "Item Fragment Icon Center"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_icon-left.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 300
#background = ""
self_link = "item-fragment-icon-left"
align = "left"

title = "Item Fragment Icon Left"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_image-button-left.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 360
background = "light"
self_link = "item-fragment-image-button-left"
align = "left"

title = "Item Fragment Image Button Left"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_image-center.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 350
background = "secondary"
self_link = "item-fragment-image-center"
align = "center"

title = "Item Fragment Image Center"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_image-only.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 330
background = "secondary"
self_link = "item-fragment-image-only-center"
align = "center"

title = "Item Fragment Image Only"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_image-right.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 320
background = "dark"
self_link = "item-fragment-image-right"
align = "right"

title = "Item Fragment Image Right"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/item_image-table-left.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "item"
date = "2017-10-04"
weight = 340
#background = ""
self_link = "item-fragment-image-table-left"
align = "left"

title = "Item Fragment Image Table Left"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/items.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "items"
date = "2017-10-04"
weight = 100
#background = "dark"
self_link = "items-fragment"

title = "Items Fragment"
subtitle= "Column based items with icons"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/items_only.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "items"
date = "2017-10-04"
weight = 110
background = "dark"
self_link = "items-fragment-only"

#title = ""
#subtitle = ""
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/logos.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "logos"
date = "2017-09-09"
weight = 1000
#background = ""
self_link = "tools"

title = "Logo Fragment"
subtitle = "Even linking is possible"
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/logos_only.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "logos"
date = "2017-09-09"
weight = 1010
background = "dark"
self_link = "users"

#title = ""
#subtitle = ""
Expand Down
1 change: 0 additions & 1 deletion exampleSite/content/index/sample-custom-fragment.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ fragment = "sample-custom-fragment"
#disabled = false
date = "2017-09-09"
weight = 1000
self_link = "sample-custom-fragment"
+++
1 change: 0 additions & 1 deletion exampleSite/content/index/table.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ fragment = "table"
date = "2017-10-10"
weight = 500
background = "light"
self_link = "table-fragment"

title = "Table Fragment"
subtitle= "Tables are responsive by default"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{{ $fragment := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $bg := $fragment.background | default "secondary" }}

<section id="{{ $fragment.self_link }}">
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/buttons.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{ $buttons := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Buttons -->" | safeHTML }}
{{ $bg := $buttons.background | default "white" }}

<section {{ with $buttons.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/contact.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{ $contact := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Contact -->" | safeHTML }}
{{ $bg := $contact.background | default "secondary" }}

<section id="{{ $contact.self_link }}">
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/content-single.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{ $self := .self }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $content_single := .self.Params }}
{{ "<!-- Content -->" | safeHTML }}
{{ $bg := $content_single.background | default "light"}}

<section>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/content-split.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{ $self := .self }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $content_split := .self.Params }}
{{ "<!-- Content -->" | safeHTML }}
{{ $bg := $content_split.background | default "light"}}

<section>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/copyright.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{{ $copyright := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $menus := .menus }}
{{ "<!-- Copyright -->" | safeHTML }}
{{ $bg := $copyright.background | default "secondary"}}

<footer class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
" id="{{ $name }}">
<div class="container">
<div class="row py-3">
<div class="col-md">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/embed.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{ $embed := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Embed -->" | safeHTML }}
{{ $bg := $embed.background | default "white" }}
{{ $ratio := $embed.ratio | default "4by3" }}
{{ $size := $embed.size | default "75" }}

<section {{ with $embed.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/footer.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{{ $footer := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $menus := .menus }}
{{ "<!-- Footer -->" | safeHTML }}
{{ $bg := $footer.background | default "dark"}}

<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
" id="{{ $name }}">
<div class="container py-5">
<div class="row">
<div class="col-md m-2
Expand Down
9 changes: 4 additions & 5 deletions layouts/partials/fragments/hero.html
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{{ $hero := .self.Params }}
{{ $name := .self.Name }}
{{ $name := replace $name "/index.md" "" }}
{{ $name := strings.TrimSuffix ".md" $name }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $path := .self.File.Path }}
{{ $path := replace $path "/index.md" "" }}
{{ $path := strings.TrimSuffix ".md" $path }}
{{ $page_path := replace $path (printf "/%s" $name) "" }} {{ $tmp_full := .tmp_full }}
{{ $page_path := replace $path (printf "/%s" $name) "" }}
{{ $tmp_full := .tmp_full }}
{{ "<!-- hero -->" | safeHTML }}
{{ $bg := $hero.background | default "secondary" }}

<header>
<header id="{{ $name }}">
{{ if $hero.header }}
<div class="jumbotron text-center header-image mb-0
{{- printf " bg-%s" $bg -}}
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/item.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{ $item := .self.Params}}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Item -->" | safeHTML }}
{{ $bg := $item.background | default "light"}}
{{ $align := $item.align | default "center" }}

<section {{ with $item.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
8 changes: 3 additions & 5 deletions layouts/partials/fragments/items.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{{ $itemf := .self.Params }}
{{ $name := .self.Name }}
{{ $name_t := strings.TrimSuffix ".md" $name }}
{{ $items:= .resources.Match (printf "%s/*" $name_t) }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $items := .resources.Match (printf "%s/*" $name) }}
{{ "<!-- Items -->" | safeHTML }}
{{ $bg := $itemf.background | default "light"}}


<section {{ with $itemf.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/logos.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{{ $logos := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Logos -->" | safeHTML }}
{{ $bg := $logos.background | default "white" }}

<section {{ with $logos.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
7 changes: 3 additions & 4 deletions layouts/partials/fragments/member.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{{ $memberf := .self.Params }}
{{ $name := .self.Name }}
{{ $name_t := strings.TrimSuffix ".md" $name }}
{{ $members := .resources.Match (printf "%s/*" $name_t) }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ $members := .resources.Match (printf "%s/*" $name) }}
{{ "<!-- Member -->" | safeHTML }}
{{ $bg := $memberf.background | default "light"}}

<section {{ with $memberf.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/nav.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{ $nav := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Nav -->" | safeHTML }}
{{ $bg := $nav.background | default "dark" }}

Expand All @@ -9,7 +10,7 @@
{{- else -}}
{{- printf " navbar-%s" "dark" -}}
{{- end -}}
">
" id="{{ $name }}">
<div class="container">
{{ if $nav.branding.logo }}
<a class="navbar-brand py-0" href="{{ "#page-top" | relLangURL }}">
Expand Down
3 changes: 2 additions & 1 deletion layouts/partials/fragments/table.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{ $table := .self.Params }}
{{ $name := strings.TrimSuffix ".md" (replace .self.Name "/index.md" "") }}
{{ "<!-- Item -->" | safeHTML }}
{{ $bg := $table.background | default "light"}}
{{ $align := $table.align | default "center" }}

<section {{ with $table.self_link }}id="{{ . }}"{{ end }}>
<section id="{{ $name }}">
<div class="overlay container-fluid
{{- printf " bg-%s" $bg -}}
">
Expand Down

0 comments on commit 9acba01

Please sign in to comment.