multi RSS hyperlink base on section and taxonomy
This commit is contained in:
		
							parent
							
								
									b343bac3f9
								
							
						
					
					
						commit
						715a82f5ac
					
				| 
						 | 
				
			
			@ -1,15 +1,21 @@
 | 
			
		|||
{{- $pctx := . -}}
 | 
			
		||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
 | 
			
		||||
{{- $pages := slice -}}
 | 
			
		||||
{{- if or $.IsHome $.IsSection -}}
 | 
			
		||||
{{- $pages = $pctx.RegularPages -}}
 | 
			
		||||
 | 
			
		||||
{{- if or $.IsHome  -}}
 | 
			
		||||
    {{/* remove page at top level from RSS, for exmaple "about" page */}}
 | 
			
		||||
    {{- $pages = where $pctx.RegularPages "Type" "ne" "page" -}}
 | 
			
		||||
{{- else if $.IsSection -}}
 | 
			
		||||
    {{- $pages = $pctx.RegularPages -}}
 | 
			
		||||
{{- else -}}
 | 
			
		||||
{{- $pages = $pctx.Pages -}}
 | 
			
		||||
    {{- $pages = $pctx.Pages -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
 | 
			
		||||
{{- if ge $limit 1 -}}
 | 
			
		||||
{{- $pages = $pages | first $limit -}}
 | 
			
		||||
    {{- $pages = $pages | first $limit -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
 | 
			
		||||
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
 | 
			
		||||
  <channel>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,18 +1,27 @@
 | 
			
		|||
<footer class="footer">
 | 
			
		||||
    <div class="footer-row">
 | 
			
		||||
        {{ if .IsHome }}
 | 
			
		||||
        <a class="footer-item" href="{{ "/index.xml" | relURL }}">
 | 
			
		||||
            The Site Feed
 | 
			
		||||
            Feed of ALL
 | 
			
		||||
            <i class="icofont-rss"></i>
 | 
			
		||||
        </a>
 | 
			
		||||
        {{ else }}
 | 
			
		||||
            <a class="footer-item" href="{{ "/index.xml" | relURL }}">
 | 
			
		||||
                The Site Feed
 | 
			
		||||
                <i class="icofont-rss"></i>
 | 
			
		||||
            </a>
 | 
			
		||||
 | 
			
		||||
        {{ if gt (len .Site.Sections) 1 }}
 | 
			
		||||
            {{ range .Site.Sections }}
 | 
			
		||||
                {{ $page := . }}
 | 
			
		||||
                {{ with .OutputFormats.Get "rss" }}
 | 
			
		||||
                    <a class="footer-item" href="{{ .Permalink }}">
 | 
			
		||||
                        Feed of {{ with $page.Title }}{{ $page.Title }}{{ end }}
 | 
			
		||||
                        <i class="icofont-rss"></i>
 | 
			
		||||
                    </a>
 | 
			
		||||
                {{ end }}
 | 
			
		||||
            {{ end }}
 | 
			
		||||
        {{ end }}
 | 
			
		||||
 | 
			
		||||
        {{ if not (or .IsHome .IsSection) }}
 | 
			
		||||
            {{ $page := . }}
 | 
			
		||||
            {{ with .OutputFormats.Get "rss" }}
 | 
			
		||||
                <a class="footer-item" href="{{ .Permalink }}">
 | 
			
		||||
                    The Taxonomy Feed
 | 
			
		||||
                    Feed of "{{ with $page.Title }}{{ $page.Title }}{{ end }}"
 | 
			
		||||
                    <i class="icofont-rss"></i>
 | 
			
		||||
                </a>
 | 
			
		||||
            {{ end }}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue