Skip to content

Commit

Permalink
Fix .md replacement
Browse files Browse the repository at this point in the history
  • Loading branch information
loic425 committed Dec 2, 2020
1 parent bfc2072 commit 96bd65a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Controller/MenuAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function __invoke(Request $request): Response
$menuItems = [];

foreach ($finder as $file) {
$slug = rtrim($file->getRelativePathName(), '.md');
$slug = preg_replace('/\.md$/', '', $file->getRelativePathName());
$menuItems[] = [
'slug' => $slug,
'path' => $this->generateUrl('mobizel_markdown_docs_page_show', ['slug' => $slug]),
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/search/index.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<h1>Search results for terms "<em>{{ app.request.get('query') }}</em>"</h1>
<ul>
{% for file in files %}
{% set slug = file.relativePathname|trim('.md', 'right') %}
{% set slug = file.relativePathname|split('.md')[0] %}
<li>
<a href="{{ path('mobizel_markdown_docs_page_show', { 'slug': slug }) }}">
{{ page_title(slug) }} [{{ slug }}]
Expand Down

0 comments on commit 96bd65a

Please sign in to comment.