larecipe: Anchor links not working as expected

Describe the bug

- [Example](#example-link)

<a name="example-link">
## Example

is directing to base_url/#example-link rather then base_url/segment1/segment2#example-link when the page url is base_url/segment1/segment2

To Reproduce Current URI = http://localhost:8000/docs/1.0/overview

# Overview

---

- [Introduction](#introduction)
- [Test](#test)

<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<a name="introduction"></a>

##  Introduction

on anchor click the uri changes to http://localhost:8000/#introduction

Expected behavior The uri should become http://localhost:8000/docs/1.0/overview#introduction

Additional context To Achieve the expected result i have to do: - [Introduction](/{{route}}/{{version}}/overview/#introduction) which doesn’t seem right to do.

“laravel/framework”: “^6.0”, “binarytorch/larecipe”: “^2.2”,

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 15 (4 by maintainers)

Most upvoted comments

@da3monHunter @intellow @classiebit @dbfx @Felo-Z @aFluxx (why is there not an @here @github?! 🙄 🤣)

Ah, I see why I don’t notice this issue anymore. Here’s a simple and reliable fix you can do whilst you wait for the PR to be merged:

Copy

vendor/binarytorch/larecipe/resources/views/default.blade.php

to your resources folder so you have:

resources/views/vendor/larecipe/default.blade.php

Then remove

		<!-- Base url -->
		<base href="{{ Config::get('app.url') }}/" />

After line 48, or right after this code:

        @foreach(LaRecipe::allStyles() as $name => $path)
            <link rel="stylesheet" href="{{ route('larecipe.styles', $name) }}">
        @endforeach

That fixed it for me.

For background, @AbbyJanke figured it out via #167 which was merged, but I’m fairly certain the package doesn’t reflect that merge yet. You can see the date there is: image

but the date of the PR merge is Sep 21: image

sorry guys for being late helping you out I just released a new version 2.2.1 please confirm the fix

@WillGoldstein awesome. Thank you.

@WillGoldstein It worked! Thanks.

Has this PR been merged. I seem to run into the same problem.

Version: "binarytorch/larecipe": "^2.2"