Skip to content

Issue #449: Manual (external) links#511

Merged
LisaFC merged 15 commits intogoogle:masterfrom
narrenfrei:external-links
Apr 16, 2021
Merged

Issue #449: Manual (external) links#511
LisaFC merged 15 commits intogoogle:masterfrom
narrenfrei:external-links

Conversation

@narrenfrei
Copy link
Copy Markdown
Contributor

As already discussed in #449 this is my suggestion to add external links (and also manual internal links) to the sidebar menu. Also the links in section index get adopted. The PR also sets the title attribute of the link tags and gives the option to set these manually. Especially for external links there is a possibility to set the target for the link. If the target is set to "_blank" also the link attribute rel=noopener will be set.

Here you can find a preview: http://docsy-dev-manual-link.narrenfrei.at/docs/external-links/

I've also added a short how to: http://docsy-dev-manual-link.narrenfrei.at/docs/adding-content/navigation/#add-manual-links-to-section-menu

This PR is based on the PR #508 (icons for sidebar menu) and should merged after it.

@narrenfrei narrenfrei changed the title WIP - Issue #449: Manual (external) links Issue #449: Manual (external) links Apr 11, 2021
Comment thread layouts/partials/section-index.html Outdated
Comment thread userguide/content/en/docs/Adding content/navigation.md
You can use `manualLink` also to add a additional cross reference to another existing page of your site. But especially for intern links you can also use the parameter `manualLinkRelref` instead of `manualLink` to use the build in Hugo function [relref](https://gohugo.io/functions/relref/ "External link to official Hugo Docs"). If `relref` can't find a unique page in your site, Hugo will throw a error message.

{{% alert title="Attention" color="warning" %}}
Although the link in the menu is set according to the parameters `manualLink` or `manualLinkRelref`, the corresponding HTML page is still generated by Hugo. It is therefore advisable to specify the URL for the external link in the normal content and / or page description.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you elaborate on this a bit - I can see that the placeholder page will be generated, but I'm not sure what you mean by specifying the URL in the normal content?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

My thought was, if somebody opens the URL of such a placeholder page (e.g.. http://docsy-dev-manual-link.narrenfrei.at/docs/external-links/internal-link/), he don't know where the menu item originally links to. So a little hint on the "normal page content" (which is shown, when the placeholder page get's opened) would be helpful.

But I have no problem to delete these paragraph, if you think it's not so important.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

No, that makes sense - let me see if I can rephrase it a bit.

@LisaFC
Copy link
Copy Markdown
Collaborator

LisaFC commented Apr 16, 2021

This is looking good! I'm happy enough with it, we can always tweak the docs further if any users find them unclear.

@narrenfrei
Copy link
Copy Markdown
Contributor Author

For me, it's also fine.

@narrenfrei
Copy link
Copy Markdown
Contributor Author

Please, one more moment. I've seen a little thing to change.

@narrenfrei
Copy link
Copy Markdown
Contributor Author

Now it should be OK.

@LisaFC LisaFC merged commit 4c82fce into google:master Apr 16, 2021
@Symbolics
Copy link
Copy Markdown

Where in the Docsy docs did the instructions for external links in the side bar end up? My guess would have been Navigation, or perhaps Look & Feel, but I didn't see anything there, nor did search turn up anything.

@narrenfrei
Copy link
Copy Markdown
Contributor Author

Where in the Docsy docs did the instructions for external links in the side bar end up? My guess would have been Navigation, or perhaps Look & Feel, but I didn't see anything there, nor did search turn up anything.

Should be found here: https://www.docsy.dev/docs/adding-content/navigation/#add-manual-links-to-section-menu

@Symbolics
Copy link
Copy Markdown

I see it now, thanks. Perhaps documentation for each of the options could be documented?

  • external link
  • Internal link
  • internal without relref
  • Hugo like link via url parameter

I'd like to use the 'hugo like link' to display the contents of a page within the Docsy site, but it's not clear how to accomplish that. A few examples would make it clearer.

@narrenfrei narrenfrei deleted the external-links branch July 15, 2021 11:13
@michelle-zymbit
Copy link
Copy Markdown

michelle-zymbit commented Jul 20, 2021

Hello @narrenfrei !

I am trying to use the 'externalLink' parameter, as you have shown here ('external link' to https://themes.gohugo.io/docsy/ in sidebar).

I have externalLink in my frontmatter of a file within the content folder, with the url to the outside site I want to link it to. I also added the code from here to my config.yaml file, but it still isn't working. Are there any steps I'm missing?

Thank you for your help!

@narrenfrei
Copy link
Copy Markdown
Contributor Author

Hi @michelle-zymbit,
first question: Is your Docsy up to date? When it's up to date, no further steps should be necessary.

Here (https://github.com/narrenfrei/docsy-dev/tree/master/content/en/docs/dev-test-content/external-links) is a link to my dev repo, where you can find the frontmatters for each kind of external links, as shown here: https://60f7d1bf27ca190008cd35fb--sad-volhard-b41b3b.netlify.app/docs/dev-test-content/external-links/

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.

4 participants