Git Product home page Git Product logo

craft-routemap's Introduction

Scrutinizer Code Quality Code Coverage Build Status Code Intelligence Status

Route Map plugin for Craft CMS 3.x

Returns a list of Craft/Vue/React route rules and element URLs for ServiceWorkers from Craft entries

Screenshot

Related: Route Map for Craft 2.x

Requirements

This plugin requires Craft CMS 3.0.0 or later.

Installation

To install the plugin, follow these instructions.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require nystudio107/craft-routemap
    
  3. Install the plugin via ./craft install/plugin route-map via the CLI, or in the Control Panel, go to Settings → Plugins and click the “Install” button for Route Map.

You can also install Route Map via the Plugin Store in the Craft Control Panel.

Documentation

Click here -> Route Map Documentation

Route Map Roadmap

Some things to do, and ideas for potential features:

  • Add support for Commerce Products / Variant URLs

Brought to you by nystudio107

craft-routemap's People

Contributors

khalwat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

craft-routemap's Issues

Get-all-urls not working

Describe the bug

Get-all-urls not working,
$element Class is a string not an type of elementInterface in https://github.com/nystudio107/craft-routemap/blob/develop-v4/src/services/Routes.php#L467

The string contains 'craft/elements/Address'

"name":"Exception","message":"nystudio107\\routemap\\services\\Routes::getElementQuery(): Argument #1 ($elementType) must be of type craft\\base\\ElementInterface, string given, called in /Users/site/vendor/nystudio107/craft-routemap/src/services/Routes.php on line 469","code":0,"type":"TypeError","file":"/Users/site/vendor/nystudio107/craft-routemap/src/services/Routes.php","line":616,"stack-trace":["#0 /Users/site/vendor/nystudio107/craft-routemap/src/services/Routes.php(469): nystudio107\\routemap\\services\\Routes->getElementQuery('craft\\\\elements\\\\...', Array)","#1 [internal function]: nystudio107\\routemap\\services\\Routes->nystudio107\\routemap\\services\\{closure}(Object(craft\\cache\\FileCache))","#2 /Users/site/vendor/yiisoft/yii2/caching/Cache.php(607): call_user_func(Object(Closure), Object(craft\\cache\\FileCache))","#3 /Users/site/vendor/nystudio107/craft-routemap/src/services/Routes.php(459): yii\\caching\\Cache->getOrSet('ElementUrls130a...', Object(Closure), 30, Object(yii\\caching\\TagDependency))","#4 /Users/site/vendor/nystudio107/craft-routemap/src/services/Routes.php(113): nystudio107\\routemap\\services\\Routes->getElementUrls('craft\\\\elements\\\\...', Array, NULL)","#5 /Users/site/vendor/nystudio107/craft-routemap/src/controllers/RoutesController.php(49): nystudio107\\routemap\\services\\Routes->getAllUrls(Array, NULL)","#6 [internal function]: nystudio107\\routemap\\controllers\\RoutesController->actionGetAllUrls(Array, NULL)","#7 /Users/site/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)","#8 /Users/site/vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams(Array)","#9 /Users/site/vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction('get-all-urls', Array)","#10 /Users/site/vendor/craftcms/cms/src/web/Application.php(301): yii\\base\\Module->runAction('route-map/route...', Array)","#11 /Users/site/vendor/craftcms/cms/src/web/Application.php(625): craft\\web\\Application->runAction('route-map/route...', Array)","#12 /Users/site/vendor/craftcms/cms/src/web/Application.php(280): craft\\web\\Application->_processActionRequest(Object(craft\\web\\Request))","#13 /Users/site/vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest(Object(craft\\web\\Request))","#14 /Users/site/web/index.php(12): yii\\base\\Application->run()","#15 /Users/toni/.composer/vendor/laravel/valet/server.php(234): require('/Users/toni/Sit...')","#16 {main}"]}

To reproduce

Steps to reproduce the behaviour:

  1. Go to actions/route-map/routes/get-all-urls (with Craft 4, 4.0.0-beta-2)
  2. See error message

Expected behaviour

Showing all public urls.

Versions

  • Plugin version: 4.0.0-beta-2
  • Craft version: 4.1.0.2

Craft 5 update

Hello

Craft-routemap for Craft 5 could be very usefull for a lot of us :)
I've not the skill to make the update, but if you have time to make it, it's great.

Thank you !

[FEATURE] Ability to request pathname only

Would be great to just get back the pathname instead of the full URL (for example, Nuxt.js wants jus the paths for generating dynamic routes)

So instead of this

[  
  "http://craft.local/news/another-news-entry",
  "http://craft.local/news/my-first-news-entry",
  "http://craft.local/work/fueling-the-good-design-movement",
  "http://craft.local/work/land-of-the-freestyle",
  "http://craft.local/work/case-study-3"
]

I would like to get back

[  
  "/news/another-news-entry",
  "/news/my-first-news-entry",
  "/work/fueling-the-good-design-movement",
  "/work/land-of-the-freestyle",
  "/work/case-study-3"
]

FYI, my current URL looks like this http://craft.local/actions/route-map/routes/get-section-urls?section=workDetail,newsDetail

I know I could just modify the array back in JavaSCript land... but if it's something easy to add to this plugin I figured it doesn't hurt to ask!! Thanks!

Error (Routes::getDbRoutes) in Craft 4 beta 4 / Routemap 4.0.0-beta.1

Describe the bug

Hello i', trying to use {% set pages = craft.routeMap.getAllRouteRules('Vue') %} in a twig template but got this error

TypeError: nystudio107\routemap\services\Routes::getDbRoutes(): Argument #1 ($siteId) must be of type ?int, string given, called in /home/stephane/Projects/osteo/vendor/nystudio107/craft-routemap/src/services/Routes.php on line 507 and defined in /home/stephane/Projects/osteo/vendor/nystudio107/craft-routemap/src/services/Routes.php:526

I've got a fresh install of craft 4 beta 4.

Thank you !

Endpoint get-all-route-rules is not working

The endpoint /actions/route-map/routes/get-all-route-rules?siteId={siteId} is not working and return empty sections and categories.

The reason seems to come from here

src/craftCMS/vendor/nystudio107/craft-routemap/src/services/Routes.php

public function getSectionRouteRules(string $section, string $format = 'Craft', $siteId = null): array{
   ...
  foreach ($sites as $site) {
                    if ($site->hasUrls && ($siteId === null || $site->siteId === $siteId)) {
  ...  
}

$site->siteId is a integer
$siteId is a string

So the condition is never met.

Maybe is the Craft CMS version that cause this issue. But maybe cast to the same type will prevent this kind of issue on other version.

Plugin version: 1.1.6
Craft CMS version: 3.5.9

Thanks for your good work.

Optional slug with multi level structure.

Hello, thanks for this great plugin :)

I need to use a structure with 2 level in craft.

I've try to set the entry URI Format like that segment/{slug}, but craft-routemap don't return the parent slug.
I've try with segment/{parent.slug}/{slug} now craft-routemap return "url":"/segment/:parent.slug/:slug" but first parent.slug is invalid (in my case vuejs don't like the dot) and now vuejs required always 2 params to use the route.

Maybe you have a better idea, to deal in that case ?

Thanks !!

craft_routes doesn't exist

When I request: /actions/route-map/routes/get-all-route-rules

I get the following error:
Base table or view not found: 1146 Table '[database-name].craft_routes' doesn't exist

Am I missing something, or has there been an update that brakes your plugin?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.