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

WIP - Attachments shortcode #636

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

narrenfrei
Copy link
Contributor

@narrenfrei narrenfrei commented Jul 16, 2021

Added a shortcode to list attachments list based on page resources or a specific folder.

See more info in the example page:
https://60f7d1bf27ca190008cd35fb--sad-volhard-b41b3b.netlify.app/docs/dev-test-content/attachments/

Any comments or ideas for improvements?

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 16, 2021
@marcelbaumann
Copy link

Looks really cool. I will use it on my site as soon as it is released and provide feedback if I found something.

The feature will improve my site quite a bit.

Thanks

@narrenfrei
Copy link
Contributor Author

Looks really cool. I will use it on my site as soon as it is released and provide feedback if I found something.

The feature will improve my site quite a bit.

Thanks

I'd completely forgotten that this PR had WIP flag. I'll check the code once more and will release the feature as as I find some minutes.

@marcelbaumann
Copy link

marcelbaumann commented Sep 22, 2021

Hello

I started to test your cool attachments' extension on my local site. I found one problem and have one improvement suggestion.

Problem

I have the following configuration

contentDir = "content"
defaultContentLanguage = "en"
defaultContentLanguageInSubdir = false
enableMissingTranslationPlaceholders = true

[languages]
[languages.en]
title = "tangly OS Components"
description = "tangly llc Open Source Components"
languageName = "English"
weight = 1

Meaning I have only one language "English" and do not have subdirectories for languages.

The attachments.html path generation code generates the wrong path.

content/content/en/ideas/learnings/trainings-files/swat-literature/01-DevDotStar_Reeves_CodeAsDesign (optional).pdf

instead of

content/content/ideas/learnings/trainings-files/swat-literature/01-DevDotStar_Reeves_CodeAsDesign (optional).pdf

The correct path should not contain the language part. If I remove the $.Page.File.Lang it works correctly.
I assume either my configuration is not supported (we should document that) or a condition should be added in the path generation code.

Improvement

My attachments are mainly pdf files. I would prefer to store them in the static folder of hugo instead of the content folder. This is the preferred approach if I read the Hugo documentation correctly.

Would it be possible to add the option to store attachments in static? Or could the path be the composition with content and static roots?

Once I made the needed changes, the code is working well. Thanks.

=> I use the current approach with all files in content so that the pages are correctly generated. Works fine and is already published on my site (e.g. https://tangly-team.bitbucket.io/ideas/learnings/lectures/). The extension is stable. Thanks for the work.

@marcelbaumann
Copy link

Added a shortcode to list attachments list based on page resources or a specific folder.

See more info in the example page: https://60f7d1bf27ca190008cd35fb--sad-volhard-b41b3b.netlify.app/docs/dev-test-content/attachments/

Any comments or ideas for improvements?

Is it time to release this change request? On my site it is stable for months now.

narrenfrei pushed a commit to raum51/docsy that referenced this pull request Feb 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indicates the PR's author has signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants