HugoBlox / hugo-blox-builder

🚨 GROW YOUR AUDIENCE WITH HUGOBLOX! 🚀 HugoBlox is an easy, fast no-code website builder for researchers, entrepreneurs, data scientists, and developers. Build stunning sites in minutes. 适合研究人员、企业家、数据科学家和开发者的简单快速无代码网站构建器。用拖放功能、可定制模板和内置SEO工具快速创建精美网站!
https://hugoblox.com/templates/
MIT License
8.2k stars 2.9k forks source link

about widget: Add support for linking to forum/chat/mailing-list #351

Closed kortschak closed 6 years ago

kortschak commented 7 years ago

See gonum/website#11.

We are using the academic theme for the https://gonum.org/ website and have a mail contact pointer to the google-groups page we use for development and user discussion. For practical reasons (avoiding spam) we ask people people (at least at first) to sign up with google groups/use the web client. This means that a mailto: scheme is incorrect for the URI we provide, but academic prefixes the URI with this scheme, giving us a link "mailto:https://groups.google.com/forum/#!forum/gonum-dev".

It could be said that we are holding it wrong, but a mailing list does seem appropriately signified with an envelope, and this is the only was that seems possible to achieve this. Are we missing an alternative, or if not, would a fix be considered? Two approaches are mentioned in the issue above, to allow configuration of the mail contact to not add a scheme, or add code to detect a scheme and not add one if it is present.

gcushen commented 6 years ago

Since it's not actually a valid email address, it might be best we consider creating another parameter such as Forum or Mailing List for it rather than storing in the Email parameter...

glciampaglia commented 6 years ago

This would be also useful in conjunction with the MailHide reCAPTCHA....

theodore-s-beers commented 6 years ago

For the time being, a solution to this can be hacked together in three easy steps. First, in config.toml, where you would normally enter the contact email address, put a Markdown link to your Google Group. It would look something like the following: email = "[Click here to join our Google Group](https://groups.google.com/forum/#!forum/gonum-dev)"

Next, in content/home/contact.md, disable the automatic mailto link: autolink = false

Finally, in themes/academic/layouts/partials/widgets/contact.html, find the following line: {{- if $autolink }}<a href="mailto:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}} And replace it with this: {{- if $autolink }}<a href="mailto:{{ . }}">{{ . }}</a>{{ else }}{{ . | markdownify }}{{ end -}}

gcushen commented 6 years ago

How about this?

reCAPTCHA for hiding email address would give a false sense of security since Academic has no backend, it's purely client side. Therefore, the email address would have to be stored somewhere in the HTML or JS anyway. A frontend only reCAPCHA implementation may possibly help protect against some general spam bots, but someone could easily write a custom bot to grab the email address.

gcushen commented 6 years ago

discussion = { name = "Discuss", url = "https://discourse.gohugo.io" } can now be added to [params] section of config.toml to add a link to forums/chat/mailing-list.

kortschak commented 6 years ago

I have just tried that and I get a problem with a len on an untyped nil:

ERROR 2017/10/30 09:33:48 Error while rendering "home": template: theme/index.html:1:3: executing "theme/index.html" at <partial "widget_page...>: error calling partial: template: theme/partials/widget_page.html:23:9: executing "theme/partials/widget_page.html" at <partial $widget $par...>: error calling partial: template: theme/partials/widgets/posts.html:61:51: executing "theme/partials/widgets/posts.html" at <len .Params.tags>: error calling len: len of untyped nil

This uses hugo v0.30.2, and academic theme at ec4fe2eb299aa37cb6ed2d2f37554101528cc48d. I've gone through the breaking changes at https://sourcethemes.com/academic/post/v2.0.0/

diff --git a/config.toml b/config.toml
index 268fe76..468591f 100644
--- a/config.toml
+++ b/config.toml
@@ -25,7 +25,7 @@ defaultContentLanguageInSubdir = false
   organization_url = ""
   gravatar = false  # Get your avatar from Gravatar.com? (true/false)
   avatar = "gophernumerical.png"  # Specify an avatar image (in `static/img/` folder) or delete value to disable avatar.
-  email = "https://groups.google.com/forum/#!forum/gonum-dev"
+  discussion = { name = "Discuss", url = "https://groups.google.com/forum/#!forum/gonum-dev" }
   address = ""
   office_hours = ""
   phone = ""
diff --git a/content/home/posts.md b/content/home/posts.md
index 27195c7..08c66bd 100644
--- a/content/home/posts.md
+++ b/content/home/posts.md
@@ -12,8 +12,11 @@ widget = "posts"
 # Order that this section will appear in.
 weight = 2

-# Show posts that contain the following tags. Default to any tags.
-tags = []
+# Filter posts by tag.
+#  By default, show all recent posts.
+#  Filtering example: `tags_include = ["hugo", "academic"]`
+tags_include = []
+tags_exclude = []

 # Number of posts to list.
 count = 5
diff --git a/content/home/publications.md b/content/home/publications.md
index a17001e..0f489b0 100644
--- a/content/home/publications.md
+++ b/content/home/publications.md
@@ -15,8 +15,22 @@ weight = 3
 # Number of publications to list.
 count = 10

-# Show publication details (such as abstract)? (true/false)
-detailed_list = false
+# List format.
+#   0 = Simple
+#   1 = Detailed
+#   2 = APA
+#   3 = MLA
+list_format = 0

+# Filter by publication type.
+# -1: Any
+#  0: Uncategorized
+#  1: Conference proceedings
+#  2: Journal
+#  3: Work in progress
+#  4: Technical report
+#  5: Book
+#  6: Book chapter
+publication_type = "-1"
 +++

diff --git a/netlify.toml b/netlify.toml
index 2fb2c7a..01d1b02 100644
--- a/netlify.toml
+++ b/netlify.toml
@@ -1,4 +1,4 @@
 [context.deploy-preview.environment]
-  HUGO_VERSION = "0.27"
+  HUGO_VERSION = "0.30.2"
 [context.production.environment]
-  HUGO_VERSION = "0.27"
\ No newline at end of file
+  HUGO_VERSION = "0.30.2"
diff --git a/themes/academic b/themes/academic
index ab24e56..ec4fe2e 160000
--- a/themes/academic
+++ b/themes/academic
@@ -1 +1 @@
-Subproject commit ab24e5646cad8d4e7b6a31ca09f6f614f13dc8c4
+Subproject commit ec4fe2eb299aa37cb6ed2d2f37554101528cc48d

The error occurs here.

        {{/* If `tags_include` is set, exclude posts with no tags. */}}
        {{ if and ($page.Params.tags_include) (lt (len .Params.tags) 1) }}
          {{ $.Scratch.Set "show_post" "0" }}
        {{end}}

I don't see anywhere where Params.tags as a slice gets set, and tags_include is not a bool AFAICS.

gcushen commented 6 years ago

You will get this error if one of your files in post/ folder is missing tags = [] in its frontmatter. Hope that helps.

kortschak commented 6 years ago

Lovely. Thank you.

kortschak commented 6 years ago

A follow up is how to set a discussion icon for social rather than an envelope? and (sorted, but) It seems that social is now bullet pointed - is there some way to turn that off?

gcushen commented 6 years ago

@kortschak you appear to be using the old header and CSS style sheet. Your CSS is not up-to-date (not from Academic v2). Perhaps you are overriding the header and/or CSS with customizations that are based on the old theme?

You can see the demo of Academic v2 at https://sourcethemes.com/academic/ .

kortschak commented 6 years ago

It's unclear to me how to fix this. We are not over-riding anything, though do we have the hugo-academic.css in static/css/, (which does not exist in the repo here anymore) so this is probably the cause. I have tried replacing static/css and adding static/js/ (which was not present) and all the styling is broken. Can you point to documentation that explains how to make the changes (we were previously using academic at ab24e5646cad8d4e7b6a31ca09f6f614f13dc8c4).

kortschak commented 6 years ago

There is a lot of colour an movement for that upgrade. The problem for us is that we use the meta tags for go get, so it means we need to override layouts/partials/header.html. Can you point to an easier way to do that?

All up though I'm satisfied that this issue is fixed. I'll raise others to cover the things I've run into in the upgrade.

alkuzad commented 4 years ago

@gcushen as netlify and formspree - two form providers included in the theme supports both honeypot (the hidden field that is not supposed to be filled) and reCaptcha (netlify on demand, formspree by default on and controlled from settings), could this setup be added into academic ? Something like https://github.com/alkuzad/hugo-academic/tree/secure_contact

bevsxyz commented 3 years ago

@gcushen as netlify and formspree - two form providers included in the theme supports both honeypot (the hidden field that is not supposed to be filled) and reCaptcha (netlify on demand, formspree by default on and controlled from settings), could this setup be added into academic ? Something like https://github.com/alkuzad/hugo-academic/tree/secure_contact

I have tried to address this comment in my pull request.