-
-
Notifications
You must be signed in to change notification settings - Fork 164
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
Add baseURL variable on See all posts button #38
Conversation
Add baseURL variable to link of see all posts button.
Fix for 404 errors in see all posts if the default URL is not root. Add a baseURL variable to the link in the button.
✅ Deploy Preview for hugo-blog-awesome ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
layouts/index.html
Outdated
@@ -17,7 +17,7 @@ <h3 class="posts-item-note" aria-label="Recent Posts">Recent Posts</h3> | |||
{{ end }} | |||
{{ if gt (len $posts) 5 }} | |||
<p> | |||
<a href="/posts/">See all posts</a> | |||
<a href="{{ .Site.Home.Permalink }}posts/">See all posts</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I missed this 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is ability to get full link from hugo.
In this example we get first element from .Site.Params.mainSections
and get matching section object from .Site.Sections
. This will allow our user to use any name for posts
directory. And for us to get full main section URL from hugo.
{{ range $firstSection := (where .Site.Sections "Section" "in" (first 1 (.Site.Params.mainSections))) }}
<a href="{{ $firstSection.Permalink }}">See all posts</a>
{{ end }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's grate! I will try that on my local project :)
Apply by changing all publishing buttons to the code suggested by @kusyka911
Kudos, SonarCloud Quality Gate passed! |
Thanks for this PR @Rayjun0525. Your contribution is greatly appreciated. @kusyka911, could you please review this? I will merge it after that. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good for me
Thanks @Rayjun0525 and @kusyka911 for your contributions. |
What problem does this PR solve?
P : Fix for 404 errors in see all posts if the default URL is not root.
S : Add a baseURL variable to the link in the button.
Is this PR adding a new feature?
no
Is this PR related to any issue or discussion?
Issue #36 (closed)
PR Checklist