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

feat: add friend link page support using shortcode (hugo-extended version requried) #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pseudoyu
Copy link
Contributor

@pseudoyu pseudoyu commented Jun 21, 2022

It's common to add some friend links to our about page or seperate pages, so I add some shortcode to
support this function and customized style.

The syntax is:

<div class="flink" id="article-container">
<div class="friend-list-div" >

{{< friend name="Pseudoyu" url="https://www.pseudoyu.com" logo="https://www.pseudoyu.com/images/author.webp" word="Blockchain | Programming | Photography | Boyi" >}}

</div>
</div>

…sion requried)

it's common to add some friend links to our about page or seperate pages, so I add some shortcode to
support this function and customized style
Copy link
Owner

@shaform shaform left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR! I've left some suggestions.

Also, could you add some examples into the exampleSite?

Comment on lines +18 to +19
.flink#article-container .friend-list-div > .friend-div a .friend-info,
.flink#article-container .friend-list-div > .friend-div a .friend-name {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to assume that some container with class="flink" id="article-container" exists, but the website's template & the shortcode itself does not generate such a container. .friend-list-div also has the same issue. This design would make it hard for the users to use this shortcode correctly. We should create another shortcode that generates the container, which is similar to the nested shortcode here: https://gohugo.io/templates/shortcode-templates/#nested-shortcode-image-gallery.

Comment on lines +1 to +16
#article-container {
word-wrap: break-word;
overflow-wrap: break-word;
}

#article-container a {
color: #49b1f5;
}

#article-container a:hover {
text-decoration: underline;
}

#article-container img {
margin: 0 auto 0.8rem;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is article-container a good name for friend lists? You also have a flink class which seems to refer to the same container. Maybe we could just use a single friend-container class and refer to the container as div.friend-container? (Or choose some other appropriate names.)

Moreover, is it really necessary to have both the container and the friend-list-div or just 1 container would be enough for your use case?

Comment on lines +6 to +14
<a target="_blank" href={{ .Get "url" | safeURL }} title={{ .Get "name" }} >
<img class="lazyload"
src={{ $src | safeURL }}
data-src={{ $src | safeURL }}
alt={{ .Get "name" }}
data-sizes="auto"
data-srcset="{{ $small | safeURL }}, {{ $src | safeURL }} 1.5x, {{ $large | safeURL }} 2x" />
<span class="friend-name">{{ .Get "name" }}</span>
<span class="friend-info">{{ .Get "word" }}</span>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" should be added around these attribute values, e.g., href="{{ .Get "url" | safeURL }}".

@@ -11,6 +11,8 @@

@import url("syntax.css");

@import url("friend.css");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of inserting this into the main css, you could insert it like this

<link rel="stylesheet" href="{{ "css/den.css" | absURL }}">

And add some checks to only include it when friend list shortcode is used: https://gohugo.io/templates/shortcode-templates/#checking-for-existence

@pseudoyu
Copy link
Contributor Author

OK, I'll do some revison according to all above suggestions and resubmit. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants